A lot knowledge about how to design robust, extensible and maintainable software can be distilled into just five principles known as the S.O.L.I.D. principles.
Resource information | Details |
---|---|
Article title | SOLID Design Principles Wikipedia Page |
Authors | Wikipedia Maintainers (Based on work from Robert C. Martin) |
Focus | Software Design |
At the foundation of software design and design patterns1 are five software design principles as first articulated by Robert C. Martin and published in several of his books2,3 and articles. The names and short descriptions of these five principles (as published in 20033) making up the S.O.L.I.D. Principles are:
1) SRP (Single Responsibility Principle): Classes should have only one reason to change.
2) OCP (Open-Closed Principle): Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification.
3) LSP (Liskov Substitution Principle): Subtypes must be substitutable for their base types.
4) ISP (Interface Segregation Principle): Clients should not be forced to depend upon methods that they do not use. Interfaces belong to clients, not to hierarchies.
5) DIP (Dependency Inversion Principle): Abstractions should not depend on details. Details should depend on abstractions.
The Wikipedia article linked above provides a starting point for further exploration, with references to both the individual principles and general discussions of the SOLID principles collectively. There are many additional articles, tutorials, and videos on the SOLID principles developed by many other authors that can be found on the open web (too many to list here). However, to really learn these principles, one cannot go wrong with reading about them in one of Robert's books2,3 in the broader context of software design and architecture.
While these design principles were first articulated in the 1990s in the era of object-oriented "Big Design Up-Front" (BDUF4) and statically typed programming languages (e.g. C++), they still apply just as much today as they are the foundation for all maintainable and extensible software. 5,6 It is hard to imagine a robust, flexible, extensible, and maintainable software package that does not employ one more of these design principles. For example, every plug-in architecture in existence (regardless of the programming language being used) depends on the principles OCP and LSP at the very least.
Learning the SOLID design principles is a key foundation for any serious software design effort.
References
-
1Design Patterns: Elements of Reusable Object-Oriented Software.
Gamma, Erich, Richard Helm, Ralph Johnson, and John Vlissides. Addison-Wesley. 1995 -
2Clean Architecture: A Craftsman's Guide to Software Structure and Design.
Martin, Robert C., Prentice Hall. 2017, ISBN 9780134494166. -
3Agile Software Development: Principles, Patterns, and Practices.
Martin, Robert C., Pearson Education. 2003, ISBN 978-0135974445 -
4Big Design Up Front.
Wikipedia -
5Solid Relevance.
Martin, Robert C., The Clean Code Blog. October 18, 2020 -
6Why SOLID principles are still the foundation for modern software architecture.
Orner, Daniel. StackOverflow Blog. November 1, 2021