Design Patterns vs Design Principles (SOLID)

 
128   96.7
Apr 29, 2010
 
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.6
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:

http://unhandled-exceptions.com/blog/index.php/2010/03/13/nyc-codecamp-2010-refactoring-to-a-solid-foundation-session-content/

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:

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

 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.

90   96.5
May 09, 2010
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
 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

70   95.9
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)

254   99.5
May 19, 2010
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.
 1 comment
 
Yeah, good point. --- Juan Perez  May 19, 2010