DEV Community

loading...

Discussion on: SOLID — Principles of Object-Oriented Design

Collapse
murrayvarey profile image
MurrayVarey

When starting to write Object-Oriented programing the SOLID principles could be difficult to understand and, if they are understood, see where and when to apply them is not trivial.

This is a really important point! It's not always obvious when and how to apply these principles. I still struggle with them, despite having wrestled with them for years.

Take the Single Responsibility Principle -- great when it works, but sometimes it can be tricky to determine what actually is a responsibility. For example, should the ShapeManager class just load shapes from a database? Or should it also write back to that database? That might sound facetious, but there are so many different ways to split responsibilities. Trying to juggle this can add a large cognitive overhead.

Still, an excellent summary of an important set of principles. Thank you Martin!