SOLID Principles

SOLID is an acronym formed from the most basic, yet very important principles in OOP, defined by Robert C. Martin, back in 2000:

1. Single Responsibility
2. Open/Closed
3. Liskov Substitution
4. Interface Segregation
5. Dependency Inversion

What I love about these principles are 2 things:

  • Simple to understand and remember. They are compact, very concrete, with smallest possible abstraction introduced. The terms that are used are class, entity and module. Class is natural OOP term, so no need for clarification. Entity is domain specific term, part of DDD theory, taken more from functionality or business related perspective. Module can be taken as set of reusable classes that fall or complement the same category (roughly saying).
  • All other principles (YAGNI, DRY, GRASP etc.) have at least some of its foundations in SOLID. That only proves how important they are. Once practiced, they will take a developer out of coding box into the modeling box. They shape the code so it naturally follows the OOP paradigm:  Class is enclosed whole that has state and behavior, with clearly defined interaction with other classes.

These principles were elaborated thousands of times, but I felt the need to clarify them further, so I can have simple, single meaning mindset about them whenever I wish to code something serious. I hope you will find it usefull as well. Just follow the links for each of them in upper buletin for further details. Please, feel free to let me know if my explanations were not clear or simple enough, I will correct them.