Today, I saw many fat squirrels in High Park eating and hoarding nuts for the winter. This behaviour runs deep for this furry animal and I believe it runs deep in us as well. It’s built into our genes and it made sense for our caveman ancestors to have this mentality. It helped them to hedge against long periods where they couldn’t find food. They over ate and hoarded just in case they couldn’t find other food sources.
Fast forward to now. I think we carry this trait into our coding practices. In this context, the behaviour causes more problems than good. The code we write every day is stuffed with “just in case” scenarios. This means we write extra features into the application that may or may not be needed. They obscure the meat of the solution, they introduce more bugs, they make maintenance a nightmare and so forth. How do we stop it?
Pair programming. When I add the “just in case” code, my pair will snap me out of my caveman thoughts and get me back to thinking about coding what it’s needed. With enough practise, we can change and we can be less influenced by our caveman thoughts. Just in case, we need to do more pair programming.