Anti-If: The missing patterns (2016) - <AUTHOR> https://code.joejag.com/2016/anti-if-the-missing-patterns.html <comment><USER2> Another pattern I've found helpful is to have branches "exit early"; if you have code like:

        if !cache.contains(key) {
          v = db.query("..")
          expiry = calcexpiry(v)
          cache.put(k, v, expiry)
          return v;
        } else {
          return cache.get(k)
        }

by the time you get to the "else", your mental stack is filled up with the cache loading logic - you have to work to recall what this else branch is triggered by.

instead, make the branch be the least complex option and exit early, and skip the else. That way, it can be read as "if this condition, do this tiny logic and exit", and that branch can then be mentally pruned.

        if cache.contains(key) {
          return cache.get(key)
        }

        v = db.query("..")
        expiry = calcexpiry(v)
        cache.put(k, v, expiry)
        return v;

<comment><USER3> Your code should be written this way instead:

        if !cache.contains(key) {
          v = db.query("..")
          expiry = calcexpiry(v)
          cache.put(k, v, expiry)
        }

        return cache.get(k)

Only one return, and everything is still in the logical order.

<comment><USER4> I don't think there is anything virtuous about a single return in languages that have catch, finally, and garbage collection.

<comment><USER5> I think it's a judgement call: I like clearly indicating when there's always a single output path but wouldn't use the single return style in that cache example if it involved an extra lookup operation for a value which is already known.

</comment></comment></comment></comment><comment><USER6> Don't use boolean parameters to toggle behaviour - they're indecipherable from the calling context. But don't then mindlessly create the cross-product of methods from every combination of true and false for your boolean parameters: If the caller would have used an expression rather than a literal to determine which version of the method to call, use enums instead of booleans or multiple methods. And don't turn setEnabled into enable/disable pairs, or setVisible to show/hide pairs - these are understood as properties, not parameterized methods.

Enums vs inheritance isn't straightforward. Enums make it easy to add new kinds, while inheritance makes it easy to add new methods. They are more extensible in different directions. If it's very rare for you to add new values to your enum, and more frequent for you to switch on that enum, prefer enums (and always throw in your default clause!). If you are adding enum values all the time, and only have a couple of methods that switch on them, then prefer inheritance. Although if you're using Java, consider methods on your enum values instead.

To understand the enum / inheritance tradeoff better, examine the Expression problem: [https://en.wikipedia.org/wiki/Expression_problem](https://en.wikipedia.org/wiki/Expression_problem)

<comment><USER7> > Don't use boolean parameters to toggle behaviour - they're indecipherable > from the calling context

This is mostly solved in languages with named parameter calling (if you use it). Example: createFile(name, contents, temporary=True)

Sometimes it is already obvious enough. In C I have no problem with set_visible(item, true);

<comment><USER8> You can mimic this in most languages: createFile(name, contents, /* temporary= */ true). Of course that doesn't guarantee that that's what that parameter is actually named, but you can write a lint for that (with quite a bit of effort).

<comment><USER9> I'm not sure about this, because it's easy to mix up two arguments of the same type.

For example, you could mean

        createFile(name, contents, /* temporary= */ true, /* overwrite= */ true)

but write

        createFile(name, contents, /* overwrite= */ true, /* temporary= */ true)

by accident.

<comment><USER10> Now I want to see something like Prettier (a code formatter that enforces _exact_ whitespace and specific optional syntax) that will parse C code and fill in the correct parameter names, in comments, based on the headers, for any boolean parameters (maybe excluding single boolean parameters?).

</comment></comment></comment></comment></comment><comment><USER11> Erlang provides an 'if' expression as syntactic sugar for 'case' (switch), which must always have a true (else) clause. The 'if' form is strongly deprecated.

Even the 'case' expression is mildly deprecated in favor of pattern matching and guards in function heads (definitions).

There are no null values, no classes and no inheritance, but the presence of atoms (arbitrary tokens that can be used like null, true, false or enumerations), and pattern matching (data polymorphism and destructuring), means that conditional execution is elegantly implemented by _functions_.

This is the second, often forgotten, meaning of _functional programming_. Providing functions as first-class types, supporting anonymous lambdas (closures), and applying functions over collections are given all the glory, but deprecating conditionals in favor of pattern matching over many fine- grained functions is just as significant.

<comment><USER12> Now that I'm comfortable with Erlang, writing in any language that doesn't support branching at the function heads is so depressing.

<comment><USER13> also not being able to write multiple versions of a function with different arity is annoying.

<comment><USER14> I recently started learning Clojure and using this pattern is immensely satisfying as well.

</comment></comment></comment></comment><comment> d--b I disagree with the comments here. This is mostly not good advice.

Ifs exist because most real world problems require them. "If the box is checked, do this, otherwise do that".

Masking if statements by syntactic sugar doesn't serve any purpose in my opinion and if anything it makes the code more opaque, or worse, may force you to duplicate code...

<comment><USER15> I was wondering which of the examples you think particular fall into this category of making the code more opaque?

I actually went into this with similar misgivings. A lot of "get rid of ifs" advice, particularly from OOP people ends up making things more complex IMO. However most of the advice other than the "Switch to Polymorphism" seem very down to earth and a simplification. Less about getting rid of ifs as if their mere presence was a stain on humanity and more how to rewrite what they are doing more clearly.

<comment><USER16> I still "believe in" OOP, but there's something that is increasingly troubling me lately: I keep thinking about the difference between the unbounded set of possible derived classes which _could_ be substituted for a base class, versus the small (probably 1-3) number of different actual implementations are ever used in a real program. It seems like this disparity indicates the mechanism we're using is overly general. Maybe this is an argument for Sum Types as opposed to runtime polymorphism.

It seems the biggest thing OOP polymorphism has going for it is that it is "open", that is, the possible derived classes need not be known in advance. But, the fact that our toolchains use a separate link step, and that linkers remain primitive and link-time code generation is not widespread, is merely an historical accident. There's no a priori reason things have to be this way.

For example, an alternative would be if all of the source for an executable were in a single image file a la Smalltalk, and compilation consisted of converting this "database of code" into a single executable (no shared libraries!) in one big-bang compilation step (no object files, no static libraries!) You could even have something which syntactically resembled open polymorphism, maybe even using existing languages almost as-is, but instead of compiling down to type erasure and dynamic pointer casts, would compile down to Sum Types (variants). (The compiler could scan the image to find all of the derived types it _could_ be and could construct a variant out of that.)

I'm not saying this is better, just putting it forth as an example of how things could be radically different than they are now (even for statically typed, compiled languages), had we made different choices. Consider the alternative, the situation we have now: we use a technique which could support anywhere from 1 to infinity polymorphic derived classes to implement interfaces which probably have approximately 2 different implementations in a typical finished program.

Perhaps an analogy would help: If we approached hardware the way we approach software, we would be using connectors which support between 1 and infinity pins everywhere when connectors which support N pins would suffice.

<comment><USER17> Sum types are a huge benefit to branchy code. Philosophically, OOP polymorphism can do a similar thing, but it doesn't really cover it as succinctly: if your operation is of the "similar data, mostly the same algorithm but with variations at points depending on the data's type", going down the polymorphic route requires a lot more naming of things to cover each variation, and then when you go to inspect it, the code is twisty and jumps all over the place. I've had a lot of bugs introduced by method boundaries obscuring the execution flow.

What polymorphism is good at is building the black box, the soft boundaries, and that isn't a good thing to do for fine-grained details. I do occasionally find a use for extension, but it's at a scale closer to "call this entire subprogram as a kind of state machine", vs "write this algorithm as a collaboration of objects abstracted away from each other".

The "alternate hard and soft layers"[0] pattern comes to mind: if what you really need is modularity, going towards full dynamism and reflection seems like a better choice than to try to extend everything statically, which creates a very large latency issue(the default response to every form of change in a static system is "recompile from the beginning, precompute all answers"). At the same time, it's not a good fit to have a vast codebase do everything dynamically since the comprehensibility and throughput suffer.

[0] [http://wiki.c2.com/?AlternateHardAndSoftLayers](http://wiki.c2.com/?AlternateHardAndSoftLayers)

</comment></comment></comment></comment><comment><USER18> > Problem: Any time you see this you actually have two methods bundled into > one. That boolean represents an opportunity to name a concept in your code.

I like this statement. After 30 years of coding, I've found that trying to do something quick/clever without naming it explicitly, for fear of letting the code get bigger, is what often leads me to write confusing code and harder to understand ifs.

I think maybe it's that naming in new code is easy, but adding new concept names to existing code as it grows gets a lot harder. I'm automatically naming when I create a new class, but when I fix bugs or touch existing files, I'm actively trying to avoid naming things and I'm trying to touch the least possible code, so over time it trends toward having unnamed concepts.

I usually try to apply naming to Pattern 4. So maybe instead of:

      return foo && bar || baz;

I might:

      bool bad = foo && bar;
      bool worse = baz;
      bool isHorrible = bad || worse;
      return isHorrible;

<comment><USER19> Just today, I was talking with a team mate about this. We had some pice of code that it's like this :

        public boolean foo() {

          if (!this.doesSomethingWithA()) {
            return false;
          }

          if (!this.doesSomethingWithB()) {
            return false;
          }

          if (!this.fooBar2000.isEmpty()) {
            return false;
          }

          if (!this.anotherLongAttribute) {
            return false;
          }

          if (!this.anotherMethod()) {
            return false;
          }

          return true;
       }

We try to replace to a "one liner" return !A && !B && !C ... Well, the expression was very long and we noted that was more hard to read that the multiple if's. I suggested split the one liner expression on multiples lines doing something like this :

        return !this.doesSomethingWithA()
            && !this.doesSomethingWithB()
            && !this.fooBar2000.isEmpty()
            && !this.anotherLongAttribute
            && !this.anotherMethod();

However, the code formatter (eclipse), changes every time it to the hard to read one liner expression. So we ended using the multiple if's.

<comment><USER17> There's a semantic thing going on with this expression that is rather interesting.

First, consider this reworking:

        boolean a = this.doesSomethingWithA();
        if (a) {a = a && !this.doesSomethingWithB();}
        if (a) {a = a && !this.fooBar2000.isEmpty();}
        if (a) {a = a && !this.anotherLongAttribute;}
        if (a) {a = a && !this.anotherMethod();}
        return a;

And then this one:

        boolean a = this.doesSomethingWithA();
        a = a && !this.doesSomethingWithB();
        a = a && !this.fooBar2000.isEmpty();
        a = a && !this.anotherLongAttribute;
        a = a && !this.anotherMethod();
        return a;

In the first version and your original, it's clear that there's short circuiting and it can return early, but automatic formatting will bloat up the vertical size of the code. In the one-liner there's also short circuiting, but it doesn't format well. In my second version you get the formatting, but it will always evaluate every possibility.

In general, when I'm favoring code formatting, the variable declarations come out. Quickly aliasing something into a name when it could exist purely as an expression adds a degree of conceptual flexibility. It keeps the code local(no new function name and jumping over into it). But it does also result in this kind of unnecessary computation.

</comment></comment></comment><comment><USER20> Overall, very good advice. I disagree on polymorphism through virtual methods being a solution to the maintainability problem switches pose, though.

With such polymorphism it's difficult to know the things that can happen. Implementations of the virtual method are not closed - they could come from anywhere in the codebase.

Another problem is that it's hard to cleanly separate the common code from the specialized code in each implementation class. That's why one ends up with ugly helper functions that receive a lot of state, or alternatively with unmaintainable class hierarchies.

IME the only solution is to minimize usage of datastructures that have choices in them ("ADTs") and minimize the coupling of the code to the choices. The latter is done by separating code paths early, and by only switching if absolutely necessary.

<comment><USER21> Polymorphism and inheritance often assume that differences are hierarchical. The real world is often NOT hierarchical, or at least may easily change to not be hierarchical in the future. Noun "classification" of most domain things is messy. It's one of the reasons for the backlash in the 2000's against OOP as a domain modelling system.

IF's often handle unpredictable variations better. Features are often better viewed as a buffet restaurant instead of an animal kingdom classification tree as found in biology. The biology classification-like approach popular in the 90's usually fails outside of biology. And, "lots of little methods" can make code rather hard to read & follow in my opinion. Your eyes may differ.

<comment><USER22> > The real world is often NOT hierarchical, or at least may easily change to > not be hierarchical in the future.

The real world is an undifferentiated unified whole, but you can't actually work with it without dividing it up and labelling/modelling it, and most useful models have a heirarchical structure. OTOH, they usually aren't a single-inheritance heirarchies, and most OOP languages either handle multiple inheritance poorly or not at all.

<comment> your-nanny OOP is lousy as an ontologicsal model of the stuff making up the real world. But that doesn't make it not useful for building designed systems.

<comment><USER21> True, but that doesn't imply one should turn most IF statements into polymorphism, or other OOP constructs. OOP is one of multiple tools in our toolbox.

</comment></comment></comment></comment></comment><comment><USER23> It's important to take this kind of advice in it's context, which I would hand-wavingly describe as "imperative old-fashioned OO".

For example, the advice "Pattern 2: Switch to Polymorphism" definitely does not hold in languages with algebraic data types, where the compiler will check that your "switch" expressions check all possible cases. Given that at least Rust, Swift, Scala, and Typescript can all do this, this kind of advice is becoming increasingly outdated.

<comment><USER24> > Pattern 2: Switch to Polymorphism

As a matter of fact it does. Polymorphisms come in many forms (pun intended). The OO-pattern of class inheritance is simply just one of them - not quite so good too if you ask me :)

The author seems to believe that polymorphism is OO-specific. But it isn't. As a matter of fact, if/switch statements are _also_ polymorphic, often used in more procedural code.

The more functional way to match on different type constructors is a fine example of a polymorphic function.

<comment><USER25> > As a matter of fact, if/switch statements are _also_ polymorphic, often used > in more procedural code.

Polymorphism has a straightforward meaning, that the same code is operating on different data types. Switch statements (if's are just a special case) are running different code on different types, so they're monomorphic.

> The more functional way to match on different type constructors is a fine > example of a polymorphic function.

I think I see where you're coming from. Here's an example of what you're talking about.

        data Foo = Foo Int | Bar String | Qux

        what :: Foo -> Foo
        what (Foo num) = Bar $ show num
        what (Bar str) = Qux
        what Qux = Foo 0

That's not polymorphic; there's a single type there, and any given code is strictly acting on a single type of data. It's just a nice way of writing a case.

And, in fact, you find out it's not magic because it gets just as messy and confusing once you have to nest logic as with imperative programming, for example, if Foo contained another ADT, I'd often have to use a case statement or equivalent to manage it.

</comment></comment></comment><comment><USER26> Fascinating. I love constrained writing and constrained poetry.

No If-statements in code reminds me a bit of the E-Prime movement ([https://en.wikipedia.org/wiki/E-Prime](https://en.wikipedia.org/wiki/E-Prime)) which was about removing the verb 'to be' and all its variants like 'is', 'was' etc from English language. Supposedly it made English easier to understand and encouraged clarity and precision.

</comment><comment><USER27> Although I generally agree with the concept the truth is it's not easy to stop using `if` or `switch` completely. By applying rules described in the post you are just pushing the problem around. At some point, somehow, a decision must be made which branch to follow. Want to create two methods instead of `if` fine, do it - how are you going to decide which of them to call? You want to use polymorphism, fine, do it - how are you going to decide which class to instantiate? What to use enums with methods on them, fine, how are you going to decide which enum to use? You may say "Oh, I am just deserializing user's input to enum. I don't have to decide." Fine, so you've just pushed decision onto users of your application. Sure, you may use some other methods, especially when you must choose from multiple options (map instead of switch, etc.) but you should always remember - just by avoiding decision making in one place, doesn't mean you've completely eliminated it from business process.

<comment><USER28> >... By applying rules described in the post you are just pushing the problem around. At some point, somehow, a decision must be made which branch to follow.

Right, and you should try and make that decision as early and as few times as possible. For example, let's say you work with older systems that have grown. You went from one type of config to two types, so now you have If (configOne) ... else ... scattered all over your code. You can't really get rid of the decision, it has to be made, but you can refactor the code to make the decision only _once_ when the app starts up.

</comment></comment><comment><USER29> Interesting article and definitely some good advice, but I completely disagree with example 4.

Surely I can't be the only person who finds

        if (foo) {
            if (bar) {
                return true;
            }
        }

        if (baz) {
            return true;
        } else {
            return false;
        }

Much easier to parse than

        return foo && bar || baz;

It's a bit better to my eye with parentheses:

        return (foo && bar) || baz;

Of course the first version is far from perfect (no need for the nested if, etc.) but I've always found too many comparisons on one line just looks messy.

<comment><USER30> Also, it's not really removing the `if`, it's just making it into `&&` and `||` instead, which are shorthand conditionals anyways. So a bit misleading to call this a anti-if strategy.m

<comment><USER31> If you have a function that's using if statements to decide which boolean to return, it's almost always better to return the expression directly.

`if (foo) { return true } else { return false }`

is the same as `return boolean(foo)`

</comment></comment></comment><comment> d--b Pattern 1 is impracticable: most reasons why you would add a Boolean parameter to a function is to avoid code duplication:

void blah(int x, bool logInfo) {

       ...

       if (logInfo) ...

       ...

}

Pattern 2 can be horrible when applied to the wrong problem. As in: you can use polymorphism to implement fact(int x) without if statements, but it's not going to be pretty...

Pattern 3 is not a pattern, it just says "if the if is useless remove it"...

Pattern 4 is particularly confusing, especially when you start to have nots in there:

var x = !(a || !b) // ugh

Pattern 5: doesn't remove the if...

<comment><USER32> Pattern 1 you can pass in a logger there or a noop logger and not have any duplication.

<comment> d--b Well, I could do operations for logging that are otherwise not required...

       if(log) { logger.write(computestuff()); }

<comment><USER15> Depending on language if you have first class functions you could also do:

      logger.write(computestuff);

Or for parameterized functions:

      logger.write(() => computestuff(a, b, c));

Then all that logging policy stuff can live with the logging and doesn't need to be checked explicitly throughout the codebase.

</comment></comment></comment></comment><comment><USER33> I would suggest one use these as a sign of "there is another way to write these code", rather than follow it without knowing why you need it.

</comment><comment><USER34> am I reading this right? it seems number 3 is suggesting I accept Optional as function/method parameters? That is an anti-pattern if ever there was one, and it also adds another layer of if's instead of removing it. an empty collection is fine, but if I accept an optional, I need to first check that the optional isn't null (because it can be!) and if its not, check if the optional has a value(basically another nullcheck, jay!). optionals should only ever be used as a return-type. I hear a lot of people say that they should be used as parameters to indicate that one parameter is not necessary, but that's what overloads are for!

</comment><comment><USER35> It's very weird to see people genuinely suggest, "Conditional logic is complicated, so try burying it in inheritance."

<comment><USER36> But it is complicated when that (I'm assuming you mean Pattern 2) switch-case expression is in a large number of locations. Every time you add or remove (in that example) species from your enumeration, you have to address that switch- case in every location (or verify that the default is fine).

By addressing it via (well, I'd use an interface or similar) inheritance the conditional logic isn't removed, but it is isolated to a few decision points. All you need to know is that you have a Foo, and my implementation whether it's a Bar or a Baz will provide the needed functions.

<comment><USER35> Semi-serious: switch cases are only complicated when you're using compilers that can't check totality for you.

<comment><USER36> I'll mostly agree with that. If you have a compiler that can check totality (I've been playing with Idris lately at home, that feature is fantastic), then the work of adjusting your switch-cases becomes much easier. But there's still a lot of work relative to, for instance, creating a type class (or in Idris terms an interface) and implementing the functions of that type class/interface for your specific data type.

Similarly, in OO-languages with interfaces, you can apply this same approach. It doesn't eliminate the conditional, it still exists in the code. But it moves where you have to think about it and reduces the redundancy across your code base.

With these things you don't even have to modify _every_ function when you add a new value to your equivalent to an enum, you just add the implementations for that new type/class.

Though it does shift the difficulty when you want to add a new function/method to the interface. Now you _will_ have to go to each implementation and add this new capability. But the nice thing, here, is that most languages with static typing (whether fancy dependently typed languages like Idris, or relatively simpler ones like Java) will make it _immediately_ clear which implementations are incomplete.

</comment></comment></comment></comment><comment><USER37> IF statements increase cost of unit tests, is what I have found. By enforcing tight code coverage standards you start seeing IF statements disappear from code as developers do not want to write a test case for each of those IF statements.

With tools like JaCoCo we track number of branches and cyclomatic-complexity in our code (which is a measure of IF statements in most cases, try/catch being the other big source of branches). We try to keep that number down to 1 as much as possible. Once was able to take a method with over 160 branches down to 1 by eliminating every IF statement. The unit test was then very trivial and only had one test.

<comment><USER38> This doesn't make any sense to me. You should still be testing the different behaviors, what difference does it make to testing if they are in a branch or in another class?

</comment></comment><comment><USER12> Garrett Smith tackled similar themes. While his emphasis is on Erlang with its function heads (a feature nearly every other language could really use) he also shows examples in Python.

His ideas changed the way I think about clean code.

* [http://www.gar1t.com/blog/solving-embarrassingly-obvious-pro...](http://www.gar1t.com/blog/solving-embarrassingly-obvious-problems-in-erlang.html)

* [http://www.gar1t.com/blog/more-embarrassingly-obvious-proble...](http://www.gar1t.com/blog/more-embarrassingly-obvious-problems.html)

</comment><comment><USER39> > Moderation in all things, especially moderation

Brilliant!

> being defensive inside your codebase probably means the code that you are > writing is offensive. Don't write offensive code.

There are some catchy insights here.

</comment><comment><USER40> Looking at the code in the examples, the first style thing that I would suggest fixing is that the name of a boolean variable should be a yes/no question which the value is an answer to. So don't name the boolean "temporary". Name it "isTemporary" instead.

Moving on to the actual point, for a balanced view just look at cyclotomic complexity. In a function, count the decision points. Every if and loop counts. Any function with 10+ decision points is too complex and needs to be refactored to make the control flow more obvious.

Following this rule will let you use if quite happily, while also avoiding the problems with it.

(A side tip. If your language has some variant of "unless", don't use it. Ever. Our brains do not do de Morgan's laws naturally. So you can write code that is clearer upon writing, but is much harder to keep straight when you're debugging. The time that you need to understand your code best is while debugging, so ease of debugging is more important.)

</comment><comment><USER41> It could be renamed "Things that suck about Java" and you wouldn't need to remove much. It's true that if-statements are something you might want to avoid in any language but Java doesn't give you as many ways to do it as I would like to see. The first part about the boolean is pretty universal for most languages.

For example the switch on type: wouldn't it be nice you could simply have a compiler error whenever you forgot to either add default or added all values? I use enums a ton in other languages that do and it's like a to-do list of code to implement if I would add for example another specie. Java just doesn't so the only compile-time safe way to have it is to force subclassing.

Equally the argument about not checking nulls inside your own application. Nullable pointers are a language problem. The argument to that function should not be nullable to begin with. It doesn't make sense to call it with null. Ever.

I find foo && bar || baz is pretty hard to parse as well. It might be easier to throw all three arguments in a switch / case statement and give all relevant states their own case. But that doesn't work in Java.

The hidden "null means something" example could easily be rewritten to a response that simply has a Error or Result state that either contain the error or the result we wanted to have. Java only allows you to return an object that you need to cast to use (Error extends BaseResult, Result extends BaseResult) or declare it might throw a particular type of error.

I think all if not most of these problems are solved in Kotlin _. Java is just not a great language to express problems in a short and succinct way without introducing side effects or massive amounts of boilerplate (sub sub sub sub classing).

_ more experienced in Swift but Kotlin devs can follow the patterns I use

</comment><comment><USER42> Let's eradicate nulls first, then do the ifs in your own time ;)

<comment><USER39> I agree that null/nil/None is one of the worst programming constructs ever invented [0] and deserves more attention than if statements.

[0] [https://www.infoq.com/presentations/Null-References-The- Bill...](https://www.infoq.com/presentations/Null-References-The-Billion- Dollar-Mistake-Tony-Hoare)

</comment></comment><comment><USER43> I'd argue against using abstract classes in general (just use interfaces) and stuffing logic in domain classes. Domain classes should be simple, not contain any algorithms or logic, and preferably be immutable. If you are putting ifs in domain classes you are doing it wrong. If you are moving logic from service classes to domain classes, you are no longer separating concerns.

If you have sixteen polymorphic methods in one service class (which is of course possible), maybe using a switch statement would actually be a bit shorter and easier on the eyes. It depends. I think about this in terms of unit tests and code paths. More ifs means more paths. Units with lots of code paths are complex and hard to test. On the other hand having code paths cross many classes and methods just moves the problem. It's a tradeoff. A few other tricks you can apply here is using enums with e.g. lambdas and other feature flags. That's a nice way to tie functionality to types or associate some default functionality with domain classes without littering them with logic.

Not using abstract classes is somewhat controversial for some but I have disliked them for quite long and find I don't need them and can trivially refactor them away whenever I encounter them in an codebase. Preferring delegation over inheritance is a good thing IMHO and using inheritance generally is something I end up regretting. I find framework code (Spring, cough) that uses abstract classes to be mostly unreadable and convoluted. You have a Thingy that is also an AbstractThingy that inherits an EvenMoreAbstractThingy that implements a gazillion interfaces that are also implemented by other thingies and yet more AbstractClasses, etc. If you have to control click through six classes to actually get to a place that actually has logic, something is deeply wrong. Deep inheritance hierarchies are a good sign your type system is struggling with your abstractions and sets you up for maintenance problems when the cohesiveness of your classes drops and coupling increases as you are forced to add stuff in places where it really shouldn't be for API compatibility reasons.

</comment><comment><USER44> > Pattern 5: Give a coping strategy

> Context: You are calling some other code, but you aren't sure if the happy > path will succeed.

I'd love to see some good examples of this if-less code in React.

I find myself writing conditionals in data provider component render methods for things like "isLoading", "hasError", and "items.length == 0".

</comment><comment><USER45> Testing if(null) inside my code always makes me feel like I've been punched in the face. Why should my code have to be on the lookout for bad parameters all of the time? But on the other hand, my code should be on the lookout for bad parameters all of the time. Advice?

<comment><USER46> If it's not an interface, then it is probably correct to crash when called incorrectly. Problems should be found early on. If it is an interface, you may need special processing. A clear way of doing this is to do the sanity checking in the interface method and then pass to a module-private method that does the work. Internal logic that calls the same method can bypass the sanity check.

</comment></comment><comment><USER47> >> Solution: Use a NullObject or Optional type instead of ever passing a null. An empty collection is a great alternative.

That doesn't work if you are building a library, or working with other software developers. The alternative is to have a strictly typed language that forces the user to pick the type of the variable.

It doesn't also fix the problem of whether you function is returning a functioning result or an error.

That's one of the thing that I like about idiomatic Rust. The Result/Option types are implemented as standard language features. You get to use them from the get-go and they reduce lots of if/then/null friction.

</comment><comment><USER48> While I agree on reducing the amount (especially either too long or nested) ifs in the code, I disagree with some of the proposed patterns, especially the #3.

Sometimes we might want to use "null" rather than an empty collection to signal something different i.e null -> error, empty collection -> no result (avoiding the debate on whether we should use some exceptions for all error management).But generally speaking, creating a new object everytime instead of passing/checking null looks like a real potential loss of performances in some (not so rare) cases.

<comment><USER49> Instead of passing/returning null, there are much clearer things for all your examples, depending on the situation: Optionals, Empty Containers, Errors. Just using null communicates very little.

<comment><USER50> Said so many times. Do not ever use nulls as flags.

It's incredibly like Python exception handling: it works well until you try to work with a somewhat complex codebase: eg paramiko. The IOErrors can be raised by any layer of the stack. So how do I handle this in the code?

Well, turns out I can't definitely tell one from another.

Same is with the null values: never use nulls as a flag unless you're absolutely sure that null value will not be boxed in another "Optional".

<comment><USER48> So your understanding of the pattern #3 is that, null was being used instead of an empty list, and in this case it's better to use an empty container. In that case, it makes sense, that's not how I understood it at first.

Oh and, I agree about the not using null thing at multiple levels.

</comment></comment></comment></comment><comment><USER51> Pattern 1: Reasonable

Pattern 2: Yes absolutely

Pattern 3: Seems a bit inefficient, allocating memory when a simple if statement would avoid calling the method at all.

Pattern 4: Would prefer

if (foo && bar) { return true; }

return baz;

Than the proposed solution which is harder to read.

Pattern 5: Just no! The repository getRecord method should have no care about coping strategies, which may change depending on the calling context. It should instead throw an RecordNotFoundException. You could also use success and error callbacks in the method signature.

<comment><USER52> Regarding pattern 3, I think the most correct way to do what the author proposes is to use Collections.EmptyList(). You get an immutable empty list, which by virtue of being immutable need only be allocated once.

[1] [https://docs.oracle.com/javase/7/docs/api/java/util/Collecti...](https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#emptyList\(\))

</comment></comment><comment><USER53> Surprised it didn't mention passing closures around ...

</comment><comment><USER54> [https://web.archive.org/web/20180627100453/https://code.joej...](https://web.archive.org/web/20180627100453/https://code.joejag.com/2016/anti- if-the-missing-patterns.html)

If link doesn't open.

</comment><comment><USER55> It probably makes me rather pedantic, but if you write about programming style, I expect you to format your code consistently. It's either `if(record == null) {` or `if (result != null) {`. Make up your mind (I know which one I prefer, but at least be consistent)

<comment><USER56> I'm not sure if it's that simple. Sometimes, you want to guard your code with an early return, which means `if (x == NULL) return errorvalue;`. However, if the function should handle both cases, I prefer to start with the "happy path", which usually means `if (x != NULL) { happy; } else { handle_sad_case; }`.

<comment><USER55> Yeah, I was addressing the inconsistent space between "if" and opening parentheses.

</comment></comment></comment><comment><USER57> In "Pattern 2: Switch to Polymorphism", he recommends not writing huge switch- statements, but instead recommends inheritance. Polymorphism is entirely doable without inheritance using interfaces and parametric polymorphism. Besides that, great advice.

</comment><comment><USER58> Mostly good advice, except that being able to execute the code in your head is a good thing. You know you have it bad when you can't do this reliably and have to break out the debugger.

(Of course, debuggers are useful too, but code that requires them is not good.)

</comment><comment><USER59> Dynamic combinators can compose logic without if statements or switches.

Imagine a combinator that takes an array of curried functions that are composed from a filter or reducer. No if statement needed if you can dynamicly compose a functional pipe

</comment><comment><USER60> The trouble with solution 1, removing a boolean method parameter and instead creating two methods like:

        public class FileUtils {
            public static void createFile(...) { .. }
            public static void createTemporaryFile(...) { .. }
        }

is that there is now no way to create a single wrapper function.

Let's say you want to create a function "createFileAndLog" which takes the boolean parameter and passes it to the underlying "createFile" function, now you have to create two "createFileAndLog" functions rather than just one, even though you didn't have the if statement in your code.

I haven't provided a great example, I know, but I've definitely split up such methods myself, felt good about it for increasing readability, then come to regret it later.

<comment><USER61> Pass the "create file" function itself as a parameter to the "create file and log" function?

</comment></comment><comment><USER62> There is actually a current book out that has 70 of similar advice. Java by Comparison: [https://java.by-comparison.com/](https://java.by-comparison.com/)

<comment><USER63> Seems like an interesting book, but for _some_ reason (your username and the fact that the only two comments you have ever written were about this same book) I am getting a feeling that you might be one of its authors.

IMO, if you are you should disclose that when you write a comment. I am all for people promoting their stuff — as long as they do so in a way that make it clear that they stand to gain from sales.

</comment></comment><comment><USER64> All of this is not new. For anyone interested in similar patterns, check out Refactoring: Improving the Design of Existing Code by Martin Fowler.

<comment><USER21> I've disagreed with many of Martin Fowler's opinions. He assumes future changes will mirror current variations. That's often false. It's over- extrapolation of what's known as a pattern for handling a future that may not fit the current pattern.

</comment></comment><comment><USER65> Mostly good advice, but without multiple dispatch, polymorphism can only work in the simplest cases, and even then it's often not worth the boilerplate.</comment>


The Linux Voice Christmas Quiz: 79 Linux and FOSS Questions - <AUTHOR> http://www.linuxvoice.com/christmas-quiz/

<comment><USER2> I am a yellow-eyed penguin. Should give my liver a rest really.</comment>


Breaking the DGA Algorithm (Win $10k in the process) - <AUTHOR> http://hackimind.com/

<comment><USER2> Would be nice if they supplied working implementations of the algorithm and sample input/output files.</comment>


Microsoft.com New Design Preview - <AUTHOR> http://www.microsoft.com/en-us/preview/ <comment><USER3> I decided to download Movie Maker so I went to Microsoft.com. They have a Downloads menu there. I clicked "All Windows Downloads". (The site is pretty fast, BTW). I selected "Windows 7", then scrolled down until I found Movie Maker. I clicked "Get it now" and it showed me the Movie Maker page. On that page I clicked Download Now, and it started downloading!

<comment><USER4> This is a reference to Bill Gates ranting about not being able to download Movie Maker easily. See here: [http://blog.seattlepi.com/microsoft/2008/06/24/full-text- an-...](http://blog.seattlepi.com/microsoft/2008/06/24/full-text-an-epic-bill- gates-e-mail-rant/)

<comment><USER5> What I never really understood about that is that nothing happened after that. No heads rolling, no massive rehash of the process, it just limped on being an utterly lame duck for another decade. Until they are finally bringing out something like a first class app store now.

Just shows the lack of direction the product was getting when you hear the totally different results that Steve Jobs got. Admittedly BG was no longer CEO then.

</comment></comment></comment><comment><USER6> Microsoft now has, IMO, the most interesting design language of any of the big tech players. I guess it remains to be seen if there will be any reward for them in the market for this but, as a developer, I find this a lot more appealing than anything Google or Apple are doing and C# kicks the shit out of Java or Obj-C.

<comment><USER7> Java runs everywhere. C# runs only on M$ plateforms…

<comment><USER8> I use Mono on a daily basis. It's a mature full featured cross platform .NET implementation.

<comment><USER9> It's not full featured. It's a pretty small subset. The most powerful things in the .Net platform are the big chunks of code which take on large business cases and make them go away.

For example the following either don't exist or are half-baked:

WCF (WsHttpBinding in particular), WWF (entirely which we use for WCF correlation), EF (not a biggy but would be nice), WPF (the best part of .Net), MEF (buggy and missing bits).

If I wanted cross platform, I'd go Java.

<comment><USER8> I do agree with you : mono is a subset of .NET, Cross platform compatibility is not the main reason for using Mono. I really like the C# and the .NET ecosystem. I use a native UI for each platform, but the core code is the same. I'm not a big fan of those generic UI toolkit ...

<comment><USER9> Agree on generic UI front!

</comment></comment></comment></comment></comment></comment><comment><USER10> Really nice support of different browser sizes. Resize your browser from wide to really narrow to check it out.

<comment><USER11> Except one thing that bugs me most on these "responsive" sites. The images are still loaded at their full resolution. Even when I reloaded after I resized the tab. Tried private tab to avoid cache - result still the same - <USER2> wide image loaded.

It's working really nice and all but I think the point of responsive sites is to make them usable on small, mostly mobile, devices. And we still live in a age when the mobile bandwidth is something to worry about. I'd imagine the battery life would suffer a bit too.

<comment><USER12> In case you didn't know, this is a pressing concern for developers that do care about performance of responsive websites. Take a look at <http://www.w3.org/community/respimg/>

Scott Jehl of Filament Group just delivered a talk at An Event Apart on Responsible Responsive Design, and released Southstreet, a suite of tools designed to make responsive design more performant. Check it out at <https://github.com/filamentgroup/Southstreet>

</comment></comment></comment><comment><USER13> That is an impressive adaptive site design update.

A couple of things I love about this is (1) the elegance of the menu toggle to top in the small (mobile-size) view and (2) the slideshow control appearance on small view and adaptation to breadcrumb implementation on large view. Quite elegant and appropriate for each environment.

Of course, it is sad that the experience is rarely consistent when you start digging deeper into the site.

<comment><USER14> _it is sad that the experience is rarely consistent..._

It's a preview.

</comment></comment><comment><USER15> We've all known it for a while, but this redesign (which I think is quite nice compared to Microsoft's previous efforts) throws their logo into stark relief. It looks outdated. It doesn't match.

I'm speculating that we'll see an across-the-board Microsoft rebrand within the next two years, including a new logo for the company. They've rebranded their core software offering, they're now changing directions on their hardware/software philosophy, and trying to gain some mindshare for their new aesthetic (and their new appreciation for aesthetics more generally) is going to be a core part of that movement.

Thoughts?

<comment><USER16> I disagree, and I don't think they're going to change their logo. The Microsoft logo isn't particularly creative, but at least it's not Verizon ugly.

(Wanna know what _is_ Verizon ugly? The new Windows logo.)

</comment></comment><comment><USER17> I don't know, I just think you can take sparse so far it becomes soulless. Simple, clean design can still be emotive. This isn't. The stock art humans make this feel more like a Big Oil annual report. (And that Products menu is a little painful!) All that said, this is leaps and bounds beyond their current homepage.

<comment><USER18> Sorry I'm not understanding but really wanting to. What do you mean "more emotive"? What exactly could be done to this page to make it more "emotive"? What takes away from its "emotiveness"?

About the products page -- overall I think it looks pretty clean, but I mostly have a problem with the "More Products" category where they bunch together a big list of random products.

<comment><USER19> "What exactly could be done to this page to make it more "emotive"? "

Comic Sans seems to do the trick for many people.

</comment></comment></comment><comment><USER20> Shouldn't the menu be all capitalized?

<comment><USER21> Words in all caps are harder to read.

<comment><USER22> I think he he is being sarcastic, about the recent changes to VS 2012, having all-caps menus.

[http://blogs.msdn.com/b/visualstudio/archive/2012/06/05/a-de...](http://blogs.msdn.com/b/visualstudio/archive/2012/06/05/a-design- with-all-caps.aspx)

<comment><USER23> Oh god, I thought that was an April Fools joke. Does Microsoft not hire design people? It looks horrific!

<comment><USER22> Given that the post is called "A DESIGN WITH ALL-CAPS" (yeah, the title is all-caps, funny thing), maybe, the real problem precisely that they are supporting their designers's view, over their user's feedback. You know, trying to defend their "artistic integrity"...

<comment><USER24> What's really funny is that a whole bunch of people are responding in the comments with all caps :-)

</comment></comment></comment></comment></comment></comment><comment><USER25> I really don't like the use of big photos like here, the new airbnb, and Bing. They are busy, space wasting and bandwidth hogs. And to my eyes they don't add anything.

<comment><USER26> They only waste space when you've got space to waste. I really like the way the layout changes as the screen size changes and the images become more cropped.

<comment><USER27> Yeah the responsive design is really well executed. But seriously, I can literally only see the nav and four images when I load this page on my desktop. Shocking usability. Every time I see a new MS offering I feel more and more that they are investing in good-looking design rather than usable design.

</comment></comment></comment><comment><USER28> Very modern, very metro, beautiful design.

I like it.

</comment><comment><USER24> That's a totally odd font choice they are using. Check out the "d", the "b" and the "p" - looks horrible in Firefox 13! [1]

Oh, and it looks terrible in Internet Explorer 8, as the layout is completely out of whack. [2]

1\. <http://static.inky.ws/image/2290/image.jpg>

2\. <http://static.inky.ws/image/2291/image.jpg>

<comment><USER29> Wow, bizarre. It looks nothing like that in Chrome.

<http://i.imgur.com/Ny3fo.png>

<comment><USER24> I've logged a bug with Mozilla: <https://bugzilla.mozilla.org/show_bug.cgi?id=769573>

</comment></comment></comment><comment><USER30> I am completely underwhelmed beyond the responsiveness, which is nice. Feels very yesterday. One click thru to products page, and it's more underwhelming. Shows lack of vision for the company. "Managing home and homework just got easier." Really? This is the best their designers and copywriters can show us?

</comment><comment><USER31> Broken in IE8 on Vista SP1 (divs are placing one after the other horizontally instead of in their proper places).

<comment><USER32> Same here, I guess it shows what Microsoft think of IE8...

</comment></comment><comment><USER33> Beautiful and much better. A little cold and sterile from all the white space but it's a step in the right direction. They'll iron things out over time.

ONE thing. Where are the Previous & Next Arrows for the main slideshow?

</comment><comment><USER34> Is this what we have to look forward to with Metro?

The design seems like a children's book combined with some ISP "landing page" from 1995. Everything is big and bold, yet the entire page is almost completely devoid of meaningful content. It's just a vast array of disorganised links, or more precisely, a whole bunch of vast arrays of disorganised links, with no sign of any rational information architecture or even basic scannability.

Sorry, but I just can't find anything nice to say about it. It has absolutely no redeeming features whatsoever AFAICS.

<comment><USER35> "It's just a vast array of disorganised links, or more precisely, a whole bunch of vast arrays of disorganised links, with no sign of any rational information architecture or even basic scannability."

What a ridiculous statement. Of course it's organised. Want to download something to extend a Microsoft product line? Click "Downloads" and choose the product line. Need Support? Click "Support". Want to buy a Microsoft product? Click "Store".

Which use cases exactly are you imagining are not supported by this "vast array of disorganised links"?

<comment><USER34> _Of course it's organised._

Really?

Go to the page. Open the first menu, "Products". They've grouped Windows stuff together and Office stuff together. On the next column, there is everything from Surface (which one?) to Hotmail. On the column after that, we have products like "Partner network" and "Microsoft in the enterprise". This column also has "Cloud services", but Azure is in the final column.

Let's try another menu, "Security". There are only four options on this menu. Let's assume I'm someone who doesn't know what every Microsoft brand means, but my friend told me I might have a virus on my Windows PC. Does that menu give me the slightest guidance about which option I need? The names are completely meaningless, unless you happen to know that Microsoft Security Essentials isn't actually a guide to the essentials of security, it's the product with anti-virus functionality.

 _Which use cases exactly are you imagining are not supported by this "vast array of disorganised links"?_

I know what I want to do, but I don't know the name of the Microsoft product or service that will help me.

I know what I want to do, but I don't know whether Microsoft offer a product or service that can help me.

In fact, just about anything except "Tell me about Windows", "Tell me about Office", or "I already know exactly which product or service I want, by Microsoft Randomised Brand Name(TM), tell me about the thing I've already found".

There is no sense of priority. No sense of leading a visitor interested in a particular area through what Microsoft has to offer. It's just a catalogue, with a lot of spurious entries thrown in and no descriptions for anything. It is empty.

<comment><USER35> You seem to be blinded by some serious Microsoft hatred. "Microsoft Randomised Brand Name(TM)"? "Office" is "random"? I suppose you think "Apple" or "Linux" or "Ubuntu" or "Sun" or whatever it is you _are_ a fan of is less random? Another ridiculous statement.

Your friend told you you have a virus? Well if you know that means "Security" click on there, and, logically being unfamiliar with the 4 choices you pick the first one, "Security Home". Bang, right there in front of you:

        "Download Microsoft Security Essentials for free.  Help shield your computer from viruses, spyware, and other malware."

If you're too scared to click twice, or if the word "Security" is unfamiliar in the context of viruses, type "virus" in the search box on the home page. First result:

        "What is a Computer Virus | What Do Computer Viruses Do.  Have you ever wondered what is a computer virus or what do computer viruses do? Learn how are computer viruses spread and how to prevent them."

Second and third results discuss virus removal.

That's the only specific use case you mentioned and I had zero problems finding the correct solution. There are plenty of legitimate reasons to criticize Microsoft (the 3 hours I wasted yesterday trying to get ASP.NET MVC 4 working is one of them). But you didn't list one valid criticism with a specific use case. The rest of your post is a vague rant.

<comment><USER34> I don't hate Microsoft. I am simply observing that their new design and information architecture are very poor in this specific case.

If you really can't understand that many of Microsoft's brand names are not literal/descriptive or why this creates a usability problem if much of the material on their home page is just links to such names without any explanation or context, there is little more I can say here.

However, straw man arguments about brand names in general or advice that boils down to "Just Google it" because the page doesn't contain any useful information don't exactly help your case.

</comment></comment></comment></comment></comment><comment><USER36> Looks like they're matching one of their main web properties' UI with their new OS IU.

In some ways that makes sense, they're going all out or bust, in other ways I'm not sure that searching thru Technet articles will be best experienced via this new UI --granted their previous IF to Technet was horrible.

Something else is that previously they had no uniform design. different teams had different designs for their domains. Once you entered a search term, all bets were off on what the page you got to would look like.

</comment><comment><USER37> I think one thing conspicuously lacking here (besides rounded borders and gradiented buttons, both of which aren't part of Metro style) is icons. Nowadays most sites use icons to add visual interest to plain text. Microsoft's old designs didn't, and I think they suffered for the lack of them. The new design is refreshing and clean but would still benefit from having some similarly clean and functional graphical elements, i.e. icons.

(Crossposting to their feedback.)

<comment><USER38> Personally I hate when icons replace text.

</comment></comment><comment><USER39> The simplicity of the metro design style is a great direction. It's in a way a forced simplicity which can minimize the UI clutter we have come to know from Microsoft. But reducing elements means that the few that you have should be as refined as possible, and proportion, scale and white space become more important. I think this site would look 10 times better and balanced with better sizing and spacing of everything.

</comment><comment><USER40> I don't see anything special about this new design. It's sparser than before, but I don't see anything "too Metro" about it. Just 3-4 images and text links. Is that supposed to mean it's Metro? Because there are a lot of similar sites like that on the web. Would Craiglist with bigger fonts, more space between links and 3 big images at the top become "Metro"?

</comment><comment><USER41> So why didn't their Surface launch site look like that?? And will they be fixing search (other than including Google GSE which would be a vast improvement).

Edited to add: the answer to my last question is 'no': <http://windows.microsoft.com/en-US/windows/search#q=surface>

</comment><comment><USER42> Good to see that the use the "menu with down-arrows" correctly, that is "on click", rather than flickery on hover.

<comment><USER43> This is one of the first things I noticed.

The problem is not just that it is flickery, it's actually often unusable.

There are so many sites that use on-hover to trigger a menu (often with sub- menus), so that if you misplace your pointer even slightly, the top-level menu option you selected disappears.

I've lost count of the number of times I have to play the game of selecting from the top level menu, back down to the item I actually want.

</comment></comment><comment><USER44> Here's one angle..MS has 2 large very different customer sets, the enterprise and the consumer and in the past it seemed that a lot of the UI was some sort of a compromise targeted to both.

The consumer tech group is definitely getting stronger at design .. and the enterprise tech arm can rely on its salesforce

</comment><comment><USER45> I'm not particularly anti-Microsoft, but I absolutely _hate_ this design. The text is so huge I find it painful to read, most of the page is taken up by a slideshow of what seem to be generic stock images, and I have to scroll before I can find anything useful.

</comment><comment><USER46> It's like a beautiful store front.

Click on almost any link and the beautiful geometric layout is replaced with something different and far less pleasant.

This would have made so much more impact on me if the theme had been deployed more consistently and thoroughly across more pages.

</comment><comment><USER47> That's the squarest site ever! I take it IE _still_ doesn't support rounded corners?

<comment><USER21> What is the advantage of rounded corners?

<comment><USER27> Rounded corners are known to draw attention inward while angular edges "point" outward, which could make rounded corners a better choice for content containers from the usability perspective. An interesting discussion on the topic here: [http://ux.stackexchange.com/questions/11150/how-do- rounded-c...](http://ux.stackexchange.com/questions/11150/how-do-rounded- corners-affect-usability)

OTOH, I love the feel of Metro and wouldn't change to rounded corners for the world.

</comment></comment></comment><comment><USER48> It's pretty nice, works well across desktop to mobile (the slide-down menus are a bit slow on mobile). My only issue is that I don't particularly care for the Sans-serif font on the section headers. It just doesn't look "right" to me.

</comment><comment><USER49> Looks neat, uncluttered and peppy! But what about the favicon? That is so 1990!

<comment><USER50> Especially when an awesome fav seems easy for those guys. I guess they probably don't want to use the Windows one because it's only one of their products.

</comment></comment><comment><USER51> Not a very efficient solution to the "Google is getting too much attention" problem. I have to respect the people who did it, even if I don't the manager who decided to show it before it's ready.

</comment><comment><USER52> Wondering if Blitz Agency designed this, they're known for doing design/web work for Microsoft.

<http://www.blitzagency.com/>

</comment><comment><USER53> Nice look, but, slow as hell to load. 15 seconds before anything appeared. Maybe because I'm in Australia. (my net connection is around 5mbit so its not that).

<comment><USER54> Only took a couple of seconds for me in Australia, though I'm on fibre.

</comment></comment><comment><USER55> Really cool responsive design, works and resizes smoothly both on FF and Chrome, while I've seen some similar implementations being very slow on Chrome.

</comment><comment><USER56> Wonder if they're planning to make ALL their web content responsive. A lot of work for their web devs!

</comment><comment><USER57> God, finally a MS website that I can actually determine something about what the company does from.

</comment><comment><USER58> Is it just me or does the guy in the last slide look like hes using a photoshopped macbook air/pro?

<comment><USER59> I don't see why they would do that, it would be beyond stupid.

<comment><USER60> I grabbed the image and tossed it into Paint.NET; there does appear to be some artifact in the center of the laptop lid that could possibly (to my unskilled eye) be (mis)interpreted as the leaf on the top of the Apple logo. However, I don't know enough about this stuff to say anything more than that someone should take a look.

</comment></comment></comment><comment><USER61> I like it but something about it (well, the entire metro design) feels... off. This is the sort of _style_ I really enjoy so I maybe it might just be the feeling that's too forward for a company like Microsoft, but something about it that I can't put my finger on makes me second guess how much I like it.

</comment><comment><USER62> There is no auto-complete in the search box. Should this not be expected?

</comment><comment><USER63> Congrats to the MS web team. Great job. Makes me want a job there. :)

</comment><comment><USER64> Uses jQuery and Modernizr libraries. Nice work Microsoft.

</comment><comment><USER65> What is bi:index used for?

</comment><comment><USER66> is there anybody who really likes these slide shows on the home page?

</comment><comment><USER67> It looks great actually! What kills ,e about Microsoft though is that, especially recently, they've done a great job in making their sites, OS, and software quite pretty but they _still_ after all this time have absolutely horrendous font rendering in Windows which kills every design they come out with. I'm a developer who uses a Mac as my primary machine, Linux as a secondary machine and in the past month has been forced to use Windows at my new job. I wasn't happy about it but it turns out I've gotten just about as productive with it as any other platform. But the problem is that now, 4 weeks in, I get terrible eye strain and the whole system looks ugly because fonts are jagged except at really large sizes. It's ironic that this new site looks awesome on my iPad and Mac but not so much on their own OS, Windows. Why can't they fix that already?

<comment><USER68> Microsoft font rendering is different, not worse.

If you want to make it more like OSX, there's a tuning app here:

<http://www.microsoft.com/typography/cleartypeinfo.mspx>

<comment><USER69> AFAIK there is no way in Windows to control hinting, which in my opinion is the thing that makes Windows' font-rendering unbearable, especially on displays with a high PPI count.

There's hacks out there, but they're exactly that: hacks. And they don't always work that well.

</comment></comment></comment><comment><USER70> Blinded by the white. Inconsistency of design between child sites.

</comment><comment><USER71> HTML5

</comment><comment><USER72> Weird, I can't see anything if Adblock is on. Make sure yours is whitelisting microsoft.com (at least temporarily).

<comment><USER73> I see everything fine here.

Using Linux with:

* Chrome 21.0.1180.4 dev with AdBlock

* Firefox 13.0.1 with AdBlock Plus and NoScript with all scripts blocked

<comment><USER71> with AD BLOCK PLUS beta! i see evrything fine, Same versions as above!

</comment></comment></comment><comment><USER74> It's taken a long while, but Michaelsoft are finally getting their shit together. Well Done!

<comment><USER75> Sorry, Michaelsoft? Was that an intentional inside joke?

<comment><USER74> I just find this really funny, and refer to MS as such: [http://brog.engrish.com/wp- content/uploads/2010/03/michaelso...](http://brog.engrish.com/wp- content/uploads/2010/03/michaelsoft_binbows.jpg)</comment></comment></comment>


The Diamond Model of Intrusion Analysis (2013) [pdf] - <AUTHOR> https://www.threatconnect.com/wp-content/uploads/ThreatConnect-The-Diamond-Model-of-Intrusion-Analysis.pdf <comment><USER2> I deplore the practice of publishing papers without a date. This could have been written any time between 2012 and last week based on the sources referenced.

<comment><USER3> It mentions 2013 in the text, and there's no sign of 2014+, so we'll call it 2013.

<comment><USER4> Good call - the paper was published July 5th, 2013. I believe it was originally published here:

[http://www.dtic.mil/docs/citations/ADA586960](http://www.dtic.mil/docs/citations/ADA586960)

I should also note that this paper is worth reading if simply to make one aware of how to view an intrusion from different perspectives.</comment></comment></comment>


It's important that cultures disappear - <AUTHOR> http://bgblog.quora.com/What-Important-Truth-Do-Very-Few-People-Agree-With-You-On-Its-Important-That-Cultures-Disappear?share=1 <comment> Ar-Curunir I'd rather live in a inefficient but non-homogenized world than one where everyone has the same viewpoint on most things but things are done efficiently.

To me the situation proposed in the article sounds like something out of a dystopian novel.

Furthermore, how would you pick one culture to standardize upon? English is only the de facto language of the world because of forced colonialization by the British, and USD is the de facto currency of international transactions only because of the excessive economic and military power that the US wields.

<comment><USER2> > excessive economic and military power that the US wields.

What makes it excessive? How much economic and military power is proper?

<comment><USER3> (Not the person you're replying to, but I'll add a quick note about the military part):

[http://en.wikipedia.org/wiki/List_of_countries_by_military_e...](http://en.wikipedia.org/wiki/List_of_countries_by_military_expenditures)

I think that having a military 2x as big as the next biggest is a sufficient definition for 'excessive'. And here, it's a lot more than 2x.

<comment><USER2> One counter is that the current (relative) global stability benefits from a pax americana. A related argument is that the Soviet Union collapsed (at least as early as it did) due to its attempt to keep up with American spending on science, technology, and military. But...

A better point is that it's inconsistent to state this:

> how would you pick one culture to standardize upon?

...and then criticize America for not conforming to a standard about the proper level of military and economic power.

</comment></comment></comment></comment><comment><USER4> As an MA student of intercultural management I have to disagree on several points. In general this text is what cultural scientists call ethno-centric, assuming a priority of one culture over another. But culture is just one solution to a solution space, that is made pushed into the unconscious, through unlearning. It's a bit rough to summarize several papers on this topic, e.g. there are several definitions for cultures, but this one fits the text. These solutions can be mediated and made to create synergies. So instead of proclaiming one global culture, it's better to see the different cultures as they are and mediate in the 3rd space where two or more cultures meet. To be a bit meta about the aspect of national culture (which is really just one aspect) as an American I would have sandwiched the answer with two compliments, but as a German I just put it frankly, and the intercultural competence let's me declare this meta-remark.

<comment><USER5> I agree that there is no 'superior' culture, yet standardization can result in superior overall outcomes even if point outcomes may not be optimal. Programming, construction, and manufacturing standardization are all founded on that principle.

Based on your education I'm hoping you can share your insight. I have observed that some homogeneous cultures such as Taiwan, Japan, and the Mexican Yucatan have a much higher degree of social cohesiveness and responsibility than areas with mixed cultures. Is there evidence that their homogeneity and breakdown of in/out groups plays a role?

</comment></comment><comment><USER6> People have commented that English is just the international language because of forced colonialization and economic dominance.

As someone whose native language is not English, I am very happy that English has become the standard language. Not because English is particularly good, but because it is A standard.

<comment><USER7> Indeed, for instance, someone Japanese doing business in Korea can use English and be understood. Whether that came about due to colonization or dominance is irrelevant, because neither side is pushing English culture on the other in that scenario any more. In fact it gives them a kind of neutrality; I don't ask you to learn Korean, don't make me speak Japanese, let's use English; we can both use that elsewhere. I'm meeting some people from Thailand later; you're going to India tomorrow, ...

This English use in meetings nobody is a native speaker, taking place in a non-English-speaking country, is a remarkable phenomenon when you think about it.

</comment></comment><comment><USER8> _We have pretty much agreed upon the English language._

Most people did not agree on it, but were pushed towards it due to economic dominance. Non-native speakers may still resent their disadvantage and would not call it an "agreement".

<comment><USER2> > but were pushed towards it due to economic dominance

Or perhaps English is good at some things that are especially useful these days? This was posted on HN a while back:

[http://garrett.damore.org/2014/10/your-language- sucks.html](http://garrett.damore.org/2014/10/your-language-sucks.html)

...the author proposes that certain languages are easier to represent electronically. I'd certainly like to see more thought and investigation along these lines.

I think ascribing the entire thing to coercion is premature. Do you have any corroborating evidence for that position?

EDIT: After writing this, it occurs to me that British colonialism was coercive in many (most?) aspects. That being said, English has been growing as a lingua franca (hah!) since the British empire has waned, so we need a mechanism more complex than coercion to explain the growing popularity of English.

<comment><USER9> It's probably relevant that early/dominant character encoding schemes were largely created by English speakers. Of course English is easier to represent.

I'd be interested to see what advantages other languages pose. I wouldn't be surprised if there are foreign natural languages that are much easier to parse for meaning programmatically than English (i.e. languages where conjugation and word endings provide explicit information that must otherwise be inferred from context/knowledge of the world that it's much harder for a computer to acquire.)

<comment><USER2> Those are fair points.

The above article seems to be claiming some objective things make English easier to represent, like the number of characters that can be represented by one byte and the way characters are combined into words (English is character sequences all the way down).

Now, as far as causality, it's also interesting that certain standardizations and simplifications happened in the English language over the past several centuries since the printing press was invented, so it might not be as much of a happy coincidence as it appears to be at first blush.

It's also worth pointing out that mechanized language preceeded computerized language by thousands of years, and Europeans weren't the first to the printed language game.

[http://en.wikipedia.org/wiki/History_of_printing_in_East_Asi...](http://en.wikipedia.org/wiki/History_of_printing_in_East_Asia)

...but the print revolution is generally attributed to Gutenberg, who certainly came much later. Why didn't the revolution happen in Asia? Why didn't Asian languages adapt to this new technology faster? Are the reasons for history all technical (Asian languages have technical debt from previous decisions) or can some aspect of Western culture be responsible as well, at least partially?

<comment><USER9> We already see Chinese being simplified to make it feasible to type on a keyboard/mobile phone. Interesting times.

I wonder if that's the same thing that happened with English and the press, just much later in history (probably related to China not industrializing until later in history.)

</comment></comment></comment></comment></comment><comment><USER10> Obviously, the point of this essay is that it is supposed to be easy to disagree with. But I feel obligated to take the bait for some reason..

The idea of a single global culture is a pretty dark path, historically speaking. It is a utopian concept that assumes there is a path that can be followed in order to pursue a more perfect mankind. It stems from the belief that ambiguity and difference are negative forces, to be eliminated instead of embraced.

I think the argument is that the darker historical paths were 'simulation' where 'emulation' would be a better model. The difference (from what I could tell) being that the underlying mechanism of cultural change are copied, instead of just the effects. It could be argued that this is already taking place - the massive reach of the internet is expanding so that more people are being influenced by the same information streams. Internet culture makes the assumption, predictably, that internet culture is good/best. But what if that isn't true? What about those who don't fit into the 'internet' cultural norms?

The author talks of of making subjective judgements about the optimal performance of certain cultures. That's a bit problematic. What about the cultures that are not "optimal performers"? What is optimal? Those who work the most hours? Those who laugh the most? Those who have the least number of fistfights? Those with the greatest GDP?

</comment><comment><AUTHOR> Many of you have probably read, or at least heard about, Peter Thiel's Zero to One. A core concept of this book is asking your self: "What important truth do very few people agree with you on?", I recently answered the question in Quora, and decided I'm going to write an essay for each truth I mentioned. Here's the first part of the trilogy.

<comment><USER11> Unsurprisingly, I think you're wrong!

An unspoken assumption in your essay seems to be that people can only have one cultural identity, which is plainly incorrect.

There is also no definition given of what it means for a culture to 'die'. I'll offer that it's when there's nobody left who follows any of that particular culture's elements. And it's when we break it down by element, that I really think your argument doesn't hold together.

Take language for example. Clearly it's a central part of cultural identity, whether used for inclusiveness or as a shibboleth. What you're basically saying is that it's important that I stop speaking a particular language. Why? Being able to speak a language other than English gives me a broader understanding of language generally, and _improves_ my English. Why should it be important for me to stop?

Or take another fundamental of culture: music. I listen to Scottish music and sing Gaelic songs. Why is it important for me to stop doing this? More generally, what exactly is the One True Music that we should all be listening to, to the exclusion of all others?

I think I'll leave it there, lest this turn into a massive rant ;-)

<comment><USER12> To support your point, I learned as much if not more English grammar during my several semesters of German in college than throughout most of my prior schooling.

</comment></comment></comment><comment><USER13> An interesting counterpoint to this which is less radical but still potentially quite controversial is Kwame Anthony Appiah's view in his book _Cosmopolitanism_ (which I'm reading right now): it's important that cultures _get contaminated_ (by other cultures), and it's important that cultures _change_.

Edit: here's a version of his argument from that book which he published in the New York Times in 2006.

[http://www.nytimes.com/2006/01/01/magazine/01cosmopolitan.ht...](http://www.nytimes.com/2006/01/01/magazine/01cosmopolitan.html?pagewanted=print)

</comment><comment><USER7> Yeah, we will have better human welfare if we become a huge homogenized mass. The evidence of better human welfare will be, why better economic output. Because that's what welfare means: all the cogs meshing together and cranking it out.

Out of this homogenized mass will emerge innovation, supposedly. I suppose it will have to, just to beat the stupefying boredom. Of course, it will be frowned upon. "Just what the heck do you think you're doing there with that innovation of yours? You wouldn't happen to be trying to start a new kind of geographically-identifiable behavior around your invention? Dare I say... _culture_? You know that is forbidden!"

By the way, English is the most spoken language? Not really; it's probably the most badly abused language, for the purposes of global trade. You have to look at other measures, like for how many is it their mother language. In how many places is new English-language literature being produced (not only business documents like purchase orders). A halfway meaningful count might be: how many moms sing English lullabies to their children.

You know, in most places, people guard their language and culture very jealously. The use of another language by a few people who have jobs with international ties doesn't constitute any evidence that their region is converting to another culture.

</comment><comment><USER14> Cultural homogeneity is anti-Bayesian.

According to the Gospel of Bayes, evidence can only be used to update pre- existing beliefs. If we consider any individual issue, no matter what beliefs we start with, sufficient evidence will move all of us toward a similar endpoint. So for example as infants we likely start with some pretty weird hypothetical ideas, and by a roughly Bayesian process move toward common notions like object permanence.

Since it is provable that Bayesian updating is the only way of knowing that is consistent, there is no magic short-cut to optimal answers, which means that a population with diverse starting points is in general going to have a few members that reach optimality fairly promptly while the rest of us are still flailing around.

If we view cultures as systems for solving problems, this implies that cultural diversity will tend to get us to better solutions to those problems sooner than homogeneity. Nor will the same culture always be the fastest to currently optimal solution: the recent upsurge in interest in Buddhist psychology is an example of a culture that achieved a pretty good understanding of the mind quite a long time ago.

By giving us a framework in which to understand the value of cultural diversity--including linguistic diversity--while at the same time placing the universality of Bayes' Rule at the centre of the knowing subject's experience, Bayesianism allows us to resolve the tension in Enlightenment humanism between a) valuing the unique and diverse forms of human expression, culture, language, etc and b) insisting there are universal principles that unite all humanity.

<comment><USER2> And Bayesian is a form of ethnocentrism... one that presumes that materialism and induction are superior, or at least inevitable, paths to knowledge and truth.

Bayesian thought also presumes clear criteria for comparing outcomes, or at least suitable heuristics that meet the same ends. Real life is much more complex and every individual, at least to some degree, is responsible for judging right from wrong, determining efficient from inefficient, and even applying meaning to continuous reality (as opposed to discrete experiments).

> ...Bayesianism allows us to resolve the tension in Enlightenment humanism...

Sure. Again, if you assume a materialist philosophy. But there are philosophies that are inherently at odds with that worldview, including philosophies that are inherently incompatible with the form of Bayesianism you're describing here. So maybe there's _a_ Gordian knot that has been cut here, but it's not _the only_ Gordian knot by any means.

</comment></comment><comment><USER15> It's always a bummer when someone offers a counterexample to his own point. Here we see: >> I recently wrote an essay: What India can Teach to the World and it basically explains how certain elements from the indian culture could improove any individual in the world.

While he holds up 3 other cultures as being closest to optimum without explanation, he also suggests that they could benefit from elements of another. This naturally leads to a more evolutionary way where differentiation allows exploration of many elements which can then be adopted by others once they're identified as "good" whatever that means.

</comment><comment><USER16> I think Robert Pirsig's concepts of Static Quality and Dynamic quality are a more useful model to view culture.

The world that is advocated here is pure dynamic quality, with nothing to latch onto and preserve static quality.

"Goodness" and "Badness" only exist in retrospect, diversity is needed for survival. Global optimal state doesn't exists.

When people strive for global optimal state, most of the time they are actually looking to create a more legible system. That is, a mechanical system over an organic one. But just because you understand more about how a system works doesn't make it "better".

</comment><comment><USER17> When we arrive at one homogeneous culture, who do we emulate to improve ourselves? How can we be sure that of two competing ideas, one is better?

Competition and contrast between cultures is what enables us to improve. The world wants to copy Silicon Valley, but during its inception it was (and to some extent, it still is) a highly iconoclastic culture.

We can not engineer an ideal society by picking and choosing aspects of different cultures, homogenizing them, and implementing it globally. It will be imperfect -- and we will have no way to improve.

</comment><comment><USER18> The underlying assumption of this entire post is that "economic, innovation and productivity performance" is the most important thing in the world. Yet this "belief" in itself is nothing but a product of the culture the author lives in. There is nothing universal about it, nor is there any real reason to agree with it. Personally I couldn't care less about "efficiency" if it means things that I consider beautiful - such as the diversity in the world - has to go away.

</comment><comment><USER19> Cultural differentiation is not only a basis for art, creativity and innovation, it is also absolutely necessary for adaptability and survival. Over-Specialization and uniformity will have many negative consequences.

</comment><comment><USER20>
      In order for humanity to truly achieve an optimal culture [...]"

You lost me here. Optimal by what metric? And making value judgements about cultures strikes me as a risky, risky business...

</comment><comment><USER21> What I would like to see disappear is the belief that traditions, languages and customs have an intrinsic value and must be preserved. Some languages are only spoken by one person: let them die already. Is your terrible local folklore and music being forgotten? Great!

Edit: It was humbling how Asimov put it in the Foundation saga. In just a few thousands years, memory of _Earth_ had been lost.

</comment><comment><USER22> He's probably right that, in order to have world peace, the world must become boring.

</comment><comment><USER23> This is a amazingly US-centric essay, and sadly, one that lacks much substance (for the type of claims it's making). There wasn't anything to back up the claim, except the one example on calendar (which pretty much is NOT culture).

Firstly, a quick fact-checking: depends on how you do your survey, English _might not_ be the most used spoken language in the world, and in some cases, not even close. There are somewhere potentially around 1-1.2 billions Mandarin speakers. And if I'm not mistaken, there are around 800-1billions English speakers in the world.

I'd also like to note that your main thesis is a hypothesis at best, and definitely not an "important truth". Not yet, as of today anyway.

Culture existed for a reason. It was not entirely historical accident that the Eastern and Western culture was different (I believe it's partly due to the farming method at the start of agriculture). With that in mind, it's only possible to have a mono culture if the living situation everywhere on Earth is the same. And until we can actually do terraforming, I don't see it happening. (After terraforming? I'd rather not guess). Remember the picture of the worldmap that note half of the world is living in a circle [0]? Even something as simple as most of South-East Asia living in cities would make a drastic different culture than sub-urban America.

I've been thinking about culture and social norms, my conclusion was that they exist as a way to make dealing with other human easier: we human if left alone all have different preferences in too many things. And if as a group, everyone has to guess how everyone else want things to be done, it just take too much effort. That's also why I think when the group is small enough, or if it's a 1-on-1 situation, social norms don't mean much.

Since human ourselves is extremely unlikely to suddenly become homogeneous (5000 years from now, if we a group of human randomly, half of them will probably still put the toilet paper roll differently than the other half), it's more likely that there will be even more culture than the past, not less. If once culture were limited by physical distance, that won't be an issue in the future.

It's more likely than not I'm similar to thinking and belief of other HN-ers than my fellow countrymen - and likewise for other HN-ers.

Finally, efficiency isn't the only goal to be optimized for human/ society. I'm not even sure if that's the main goal or not. Likewise for happiness - we're not all utilitarian, are we?

[0]: [http://io9.com/more-than-half-of-the-worlds-population- lives...](http://io9.com/more-than-half-of-the-worlds-population-lives- inside-t-493103044)

<comment><USER24> Mandarin (a language I speak) does not have as many speakers as you guess.[1] We can be absolutely sure that the number of people in the world conversant in Mandarin is strictly less than the current population of China by hundreds of millions of individuals.

[1] [http://news.xinhuanet.com/english/2007-03/07/content_5812838...](http://news.xinhuanet.com/english/2007-03/07/content_5812838.htm)

[http://www.bbc.com/news/world-asia- china-23975037](http://www.bbc.com/news/world-asia-china-23975037)

<comment><USER23> China is a huge country though. At 1.3 billions population, 70% is a solid 900 millions speakers, add in a bit out of country and it's not inconceivable for the number to reach a billion or more.

Either way, it's just a technical details that doesn't affect much of my original point: I don't believe it's a clear cut case of "We have pretty much agreed upon the English language". In EU and of course US, that claim might hold some water. But when it comes to the rest of the world ... that seems far from being settled (And I don't know what's the situation in Africa, or South America is).

</comment></comment></comment><comment><USER25> Eine Welt Eine Sprache Eine Kulture</comment>


The Coming Changes of K-12 Science Education - <AUTHOR> http://www.livescience.com/40283-ngss-science-standards-change-education.html

<comment><USER2> Does anyone else get annoyed by the fact that when you page down you miss stuff because the banner at the top isn't considered in the calculation of how far to step?

Why do web designers break this most basic function?</comment>


Facebook is not all about the money - <AUTHOR> https://www.facebook.com/notes/kent-beck/is-it-about-the-money-money-money/1045768478789349 <comment><USER2> Do it for free then.

<comment><AUTHOR> Who will pay for the servers?</comment></comment>


Open source and money - should FOSS developers be paid? - <AUTHOR> http://www.r-statistics.com/2010/09/open-source-and-money-why-r-developers-shouldnt-be-paid/ This post delves into the issue after being raised in the context of problems discussed with R, a free open source software for statistical analysis. <comment><USER2> "Money doesn't motivates us to help each other with R"

This might be the case. However, If you aren't paying someone for development, they will most likely only be able to work on your project after the bills are paid (and if they are married/have kids, this means they will have even less time to work on it).</comment>


Stripe vs. Paypal, which one you think is better (and why)? - <AUTHOR> I just launched a marketplace for artists, designers, illustrators to showcase and sell their creative work and services, and many freelancers asked whether we take Paypal as a form of payment. I want to ask which payment processing is better for a marketplace that plans to expand to the global market? <comment><USER2> A friend has stopped offering Stripe to customers of his Magento hosting service. The reason, he told me, is that Stripe frequently delays payments. You can find lots of articles about issues with Stripe on the web.</comment>


Satya Nadella: DREAMers make our country and communities stronger - <AUTHOR> https://www.linkedin.com/pulse/dreamers-make-our-country-communities-stronger-satya-nadella <comment><USER2> This really frustrates me. Children should not be punished for crimes of parents but they should also not benefit from them. As legal immigrant that went through tons of trouble to get my green card after 8 years I feel insulted when people praise illegal immigrants. If you want open borders then change the law, until then its illegal. To me this is similar to parents robbing a bank and giving children 100K and government is saying "oh, don't punish children for parent's crimes so go ahead and keep those 100K, it's ok". They should be deported and blame their parents for it, not the government.

<comment><USER3> The thing about the immigration debate in this country is that neither side can agree on the severity of entering our country without papers. You just compared it to robbing a bank. I think of it more like jaywalking.

The thought that a child would be taken from their home and put on a one way plane to a place they've never been before because their parents are guilty of jaywalking seems dystopian.

<comment><USER4> So how do you feel about trespassing?

</comment></comment></comment><comment><USER5> >As a CEO, I see each day the direct contributions that talented employees from around the world bring to our company, our customers and to the broader economy. We care deeply about the DREAMers who work at Microsoft and fully support them. We will always stand for diversity and economic opportunity for everyone.

Diversity doesn't require illegal immigration, nor are the children of illegal immigrants particularly beneficial to their host country -- if you have any faith in our system (that should be designed to select for the best and brightest), you'd have to admit that the immigrants admitted by a real merit- based immigration system would be superior to immigrants admitted more or less at random. The only traits that illegal immigration selects for are desperation and a willingness to break laws and live on the fringes of society.

Not that I believe Satya Nadella is sincere in any case, this is just evidence of the growing politicization of large tech companies (as the anti-trust suits loom) -- large corporations don't support liberal causes out of genuine concern (corporations are by default, sociopathic) -- they're trying to do political astroturfing: the goal is to prolong the continued existence of their monopolies. If the issue of concentration of power in the tech giants were to be handled solely (and dispassionately) by the appropriate financial regulatory bodies, it would be over very quickly. The large tech giants plan to avoid that by making their existence an ongoing issue in the cultural cold war, split the popular opinion down the middle, and make the issue too political to ever be resolved.

<comment><USER6> I think the suggestion is that if the immigrants were Caucasian, this would not be a big deal. Which is true; most people of Irish, Scottish and German descent came here when the standards of entry were fad less rigorous. If lax immigration policy selects for illegal behavior, then most Caucasian should be sequestered into camps, should they make us the victims of their illegal behavior.

<comment><USER7> Irish immigrants during the 1840-1900 period were not initially considered "white", nor were Italians & Spanish during their period of peak immigration (1890-1920 & 1830-1860, respectively). You see this with NINA (No Irish Need Apply) signs around the turn of the century, and with old WW2 movies where the Italian and Spanish characters are often still called "wops" or "spics". There are some fascinating books and articles on this, eg. [https://books.google.ie/books/about/How_the_Irish_became_whi...](https://books.google.ie/books/about/How_the_Irish_became_white.html?id=w7ztAAAAMAAJ&redir_esc=y)

The history of immigration and of "whiteness" in the U.S. is a fascinating study in cognitive biases. If you look at groups that we consider fully American now (eg. Irish-Americans) vs. how we considered them when they first immigrated, it's night-and-day (except for African-Americans people, who were shat upon when they were first brought over and are still shat upon now). It's clear, historically, that we were mistaken in the past, and yet _people still make the same mistake_ , probably because it is evolutionarily useful to consider yourself superior to other people and socially useful to do so in groups. Indeed, even in the most PC, liberal, progressive, colorblind, diversity-affirming circles, the same dynamic still plays out, except that the "other" in those cases is rural dwellers, or people who didn't graduate from college, or folks who live in the South.</comment></comment></comment>