Back to list
Views:   132.3K
Replies:  8
Archived
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.


Craig Johnston, Apr 29, 2010
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.
May 07, 2010
Reply 1
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!

Johan Van Tonder, Mar 28, 2015
Reply 2
And don't forget the Law of Demeter

http://en.wikipedia.org/wiki/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.
Aaron Burton, May 19, 2010
Reply 3
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)
Ram Pandey, May 16, 2010
Reply 4
Hi,

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.

http://www.codeproject.com/KB/architecture/Design_Principles.aspx
Saurabh Saxena, May 09, 2010
Reply 5
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:

http://unhandled-exceptions.com/blog/index.php/2010/03/13/nyc-codecamp-2010-refactoring-to-a-solid-foundation-session-content/
Alexander Dimauro, May 09, 2010
Reply 6
Here's a good link on the topic of SOLID design principles:

http://www.davesquared.net/2009/01/introduction-to-solid-principles-of-oo.html

Sreenivas Manyam Rajaram, May 06, 2010
Reply 7
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.
Lalitha Lydia, May 05, 2010
Reply 8
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.
Neelakandan Dhanigachalam, May 01, 2010
The Google Singleton Detector, or GSD, is a tool which analyzes Java bytecode and detects the use of Singletons. It detects four different types of global state, including singletons, hingletons, mingletons and fingletons, to allow you to see all of the uses of global state inside a project and remove them.... to help testing http://code.google.com/p/google-singleton-detector/
Apr 09, 2010
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas