You may have heard of the Anti IF Campaign:
The primary purpose of our campaign is to become aware of the design consequences of using IFs and of control structures in general, applied by following the path of the procedural paradigm in Object Oriented contexts
As Francesco Cirillo wrote: The basic problem is that IFs create dependencies, coupling between modules (methods, objects, components, etc.) and increases possible paths inside our code (which reduces legibility).
What I’ve noticed is that this disease of creating dependencies and coupling is true also in other non tech disciplines and it’s built in our brain:
“IF I had time, I would go to the gym”,
“IF my boos were not a bastard, I could do more interesting stuff and have a decent carrier”,
”IF my girlfriend were more understanding, we might spend more time together (watching football on TV 🙂 )”,
“IF that stuff had happened, I would have been more successful”
So it seems this IF pattern is a creator of dependency from excuses and alibis and has the power of make our life more messy.
How can we get out of this pattern??? That’s a tough one, and that’s why we need to extend the Anti IF Campaign everywhere: what do you think Francesco 🙂 ?
p.s. For developers only: what’s the McCabe index of life 🙂 ???