Object-Oriented Design has been around for a few decades now. Therefore, we have whole generations of developers that have been taught OOD in their college courses as well as in their studies. I am a big fan of this approach to software. However, this, like many other theories, must be taken in moderation. You can over-design your objects just as databases can take normalization too far.
Sand vs. Legos
When I mention moderation, I think of a discussion from years ago about design. We were building a rather large and complex system at the time. It also needed to be very flexible. Our initial plans were not far from a microservice approach. Every function in the system was a snippet of code that we could put together with others. This approach was incredibly flexible. However, it was a pain to maintain. It also ended up being too much overhead in many cases as we had to cobble together large numbers of snippets and their related cost. Our discussion led us to refer to what we were building with as sand.
What we wanted, we decided, was to build with Legos. Think about it. You can create a large structure starting from sand. The bricks can be of a custom design, but that is overkill for most buildings. It is much easier to start with blocks and build from there. This is where the Lego idea comes into play. We can create some bricks of varying sizes and colors without having to create everything from a grain of sand.
Keep The Goal In Mind
In this episode, we look at how to find a level of design for our solution that matches the problem. We also cover some things to keep in mind to avoid going too deep or too shallow in our models. In the end, this helps us find that balance of flexibility, scalability, and maintainability that we need for an elegant design.