While I was writing my series on building a PHP framework, I kept coming back to one coding principle: preventing unnecessary complexity.
There are a lot of similar and related principles out there, but they all boil down to the same idea: keep things as simple as possible. And they are all correct.
It's pretty simple, usually, to find these mistakes in an existing codebase. In this post I want to take it a step further and explore when you do need to add complexity, and when you should avoid it.
The basic principle is very simple. But it is a hard concept to completely grasp. I believe that to be why there are so many different names and variations on the topic:
All true, but also, not very helpful on their own. These principles are very general and miss nuance. Let's dive into some examples of unnecessary complexity.