Don’t get fooled by the complex solution

Faced with two competing hypotheses, we are likely to choose the most complex one. That’s usually the option with the most assumptions and regressions. As a result, when we need to solve a problem, we may ignore simple solutions — thinking “that will never work” — and instead favor complex ones – Complexity Bias

If the best skill you can have in your business is making valuable decisions for your clients you need to make sure you don’t fall for complexity.

I know I’ve fallen for it when I’ve written code. I’ve tried to come up with a few rules to fight complexity.

  • no methods more than six lines
  • always write the docblock at the top of the Method first and make sure I haven’t strayed from it
  • no code that takes more than 80 characters of width

I do break them, but when I do I have an internal discussion about why I’m breaking the rule.

Do you have any quick rules to avoid overly complex code?

Read about Commplexity Bias