So, the SOLID principles:
- S - Single Responsibility Principle
- O - Open / Closed Principle
- L - Liskov Substitution Principle
- I - Interface Segregation Principle
- D - Dependency Inversion Principle
Writing about the SOLID principles has certainly firmed up my knowledge on the subject. It has also been useful to understand that these principles are a guide and not something that you absolutely must use every time. There are other important points in design to consider, for example code readability is important but SOLID principles encourage the abundant use of interfaces and dependency injection. This tends to decrease readability and make code flow harder to follow. Typically people see that trade-off and accept the slight hit on readability but there may be situations where readability is more important.
As ever, if you disagree with any of this let me know. Every day is a school day!
Got a comment or correction (I’m not perfect) for this post? Please leave a comment below.