I started using C++ over 15 years ago. I still use it every day on the job. I have picked up some other OO languages along the way as well. When I learned OO principles, there was a quote I heard often:
When an OO problem looks too difficult, add more objects.
It usually worked, but price was complexity. Simplification by adding complexity. After years of maintaining my own code, as well as other’s, I no longer believe in the philosophy of the quote. My current philosophy fits better with:
When an OO problem looks too difficult, stop using OO.
This works really well, I just had to stop feeling guilty about losing faith in OO. Nowadays I am a mentor to younger developers (for better or worse) and one of my big challenges is getting them to understand why foolish consistency to OO is a problem, not a solution. Over engineering is a real problem (not just with OO). I attribute much of my change to:
- Using Agile processes that force me to ask “Am I going to need it?”. If I am not going to need it, why am I coding it?
- Working with dynamic languages to get side projects completed quickly. What if all my projects worked as well as my side projects?
- Realizing that code is just a means to provide value to a user. The user wants the value, not the code.
- Discovering that code is suppose to be temporary, it’s the data that lives on. The code you wrote yesterday sucks, and it always will.
- Understanding that simpler does not mean not as good. It never means complicated, but it can sometimes mean elegant or even robust.
If you think it’s hard to get young developers to understand these ideas imagine how hard it is to get experienced developers to accept them. There are signs all over the place, you just need to look for them.