Home  /  Questions  /  Question

128   96.7
Apr 29, 2010

Design Patterns vs Design Principles (SOLID)

I was reading the other day a discussion on Design Patterns versus Design Principles called SOLID.

For those who are not aware of this, SOLID is an acronym for the first 5 principles of object-oriented design:

  1. SRP The Single Responsibility Principle: -- a class should have one, and only one, reason to change.
  2. OCP The Open Closed Principle: -- you should be able to extend a class's behavior, without modifying it.
  3. LSP The Liskov Substitution Principle: -- derived classes must be substitutable for their base classes.
  4. ISP The Interface Segregation Principle: -- make fine grained interfaces that are client specific.
  5. DIP The Dependency Inversion Principle -- depend on abstractions not on concrete implementations.
You'll find a fair amount of information on the web on these principles.

It seems to me that you need a good grasp of the SOLID principles before you're ready to tackle Design Patterns (in more of an Architect role).  At least that is how my educational & career process evolved. Does anyone have other experiences or opinions? 

I am curious to hear how other .NET developers learn and internalize Design Patterns.

 1 comment
Sorry, my english is not very good. It seems to me that those are not opposing topics; I think they are parts of the same idea, in fact some elements of SOLID match the ideology of pattern design. --- Diego CaMacHo  May 07, 2010

270   99.7
May 09, 2010
For all things SOLID, just do a search for 'Uncle Bob Martin', or 'SOLID Programming Principles'. The best book to get started is Agile Principles, Patterns and Practices in C# by Robert and Micah Martin.

Learning Design Patterns + SOLID principles changed my programming for the better (MUCH better!). There are many resources on the internet, that would be the best place to start, and the book I mention above is a must-have for C#.

Find a good users group, or visit a Code Camp if there is one near you, there are usually a lot of good talks related to Design Patterns and SOLID principles. Here's one presentation on SOLID:


May 01, 2010
Yes I agree.

I myself, I also went through the same process to improve my professional skills. First, I studied up on the SOLID principles. After that, when I started to design using these principles, most of the time, Design Patterns got automatically implemented.

May 06, 2010
Here's a good link on the topic of SOLID design principles:


 1 comment
Thanks for the link. A good overview. --- Alexander Dimauro  May 09, 2010

50   50
May 05, 2010
On each of the SOLID design principles, I would like to see some more detailed explanations and example code. This would be of great help to beginning .NET developers. Any pointers or links would be appreciated.

100   96.6
May 09, 2010

I understand SOLID is basis for the good programming, but there are few more design principles which should also be taken into consideration for good design.

1. DRY
2. YAGINI - Microsoft has used this principle quite extensively in the developement of windows 7.

Not very sure but can get the basic information of these two principles on URL.

 1 comment
Also, do not forget KISS (Keep It Simple Stupid). Check this link: http://en.wikipedia.org/wiki/KISS_principle --- Robert Blixt  May 19, 2010

80   96.4
May 16, 2010
What i know is that there are not just 5 Design principles. There are almost 10 Design principles.

1. Open Closed Principle
2. Liskov Substitution Principle
3. Dependency Inversion Principle
4. Interface segregation Principle
5. Release Reuse Equivalency Principle
6. Common Closure Principle
7. Common Reuse Principle
8. Acyclic Dependencies Principle
9. Stable Dependencies Principle
10. Stable Abstraction Principle

For sort description please see http://geekswithblogs.net/ramkinkarpandey/archive/2009/10/03/how-to-write-a-good-code-again.aspx
For detail please see  www.objectmentor.com (Robert C. Martin)

264   99.7
May 19, 2010
And don't forget the Law of Demeter


Some apps let you chain dot all the way through the object model (as in: Customer.Orders[9].LineItem[2].Product.Name)
While it's great for programming its terrible for performance.
 1 comment
Yeah, good point. --- Juan Perez  May 19, 2010

50   50
Mar 28, 2015
Here are some principles mentioned in "Head First: Design Patterns (Freeman, Eric; Robson, Elisabeth; Bates, Bert; Sierra, Kathy (2004-10-25). O'Reilly Media.)"...

  • Identify the aspects of your application that vary and separate them from what stays the same.
  • Program to an interface, not an implementation.
  • Favor composition over inheritance.
  • Depend upon abstractions. Do not depend upon concrete classes.
  • Principle of Least Knowledge: talk only to your immediate friends.
  • The Hollywood Principle Don’t call us, we’ll call you.

Happy coding!