Writing SOLID code – OO Design Principles
Setting the Stage
Going to geek out a bit on this post. I had a friend come up to me a while back and point me towards several screencasts on writing good Object-Oriented (OO) code in .NET using SOLID design principles.
Now, I had read the wonderful book on OO design patterns for Java developers Head First Design Patterns, so it turns out I was familiar with all of the core SOLID design principles from reading this book. But I just hadn’t head the acronym SOLID before. So what are SOLID design principles?
SOLID Design Principles
So “SOLID” is actually an acronym for 5 key OO design principles, which are as follows:
- Single Responsibility Principle (SRP)
- Open-Closed Principle (OCP)
- Liskov Substitution Principle (LSP)
- Interface Segregation Principle (ISP)
- Dependency Inversion Principle (DIP)
Perhaps frustratingly, I’m not actually going to discuss the meaning of these OO design principles here. Rather, the list above contains hyperlinks to screencasts that illustrate each of the SOLID design principles. So if designing good OO-based software is of interest to you, and you haven’t encountered these principles before, I recommend you give these screencasts a boo.
What is the origin of the SOLID acronym?
Well, good OO design principles probably date back at the very least to the Smalltalk community of the early 1980s (I think). But as this Wikipedia article states, the SOLID acronym was introduced by Robert C. Martin in the early 2000s. Here’s a link to a paper Martin wrote in 2000 explaining SOLID Principles of OO Design.
So that’s about all I have to say on the matter for now. 🙂