2 ms·
Option 2 is less changeable if you now also have to consider e.g. `a && c`. I'd argue it was less readable too (two `doSomething()` to consider vs one is bad)
by zimpenfish 11y ago
Option 2 is less changeable if you now also have to consider e.g. `a && c`.
I'd argue it was less readable too (two `doSomething()` to consider vs one is bad) but this is largely personal prejudice - I'd always spell things out "noddy fashion" like Option 1 because I am a simple brained developer.
- d--b 11y agoOf course it depends on the case. But the point is that if you chose Option 1, and you have to change doSomething() in to doYetSomethingElse() in the case where a && !b, then you _will_ have to change the structure to Option 2. So in many cases, it's better to go to Option 2 directly.
- agumonkey 11y agoOne should write a boolean refactorer to be able to test exhaustiveness and different nesting patterns.