What practical experiences you have from using Software Design Patterns?

You should definitely avoid "Pattern Driven Design" where you try to cram as many patterns as possible into your classes. I find it useful to know the most important design patterns and when I come across a new design problem I ask myself the question "Do I know a pattern that can be useful here?". If I do then I try to use it; if not then I don't (I also sometimes look them up for I don't know every pattern by heart).

Design patterns can really help you to improve your code but used wrongly they can also really mess things up.


My experience is that most programmers who talk about DP do not understand one bit of the forces etc. around it! To quote Yegge in his great Singleton Considered Stupid :

If they claim expertise at Design Patterns, and they can ONLY name the Singleton pattern, then they will ONLY work at some other company.


Re that people who may not have experience with all the patterns will be able to understand what your code is doing

I think it is the other way around. Patterns is a good way of communicating a design so if people don't understand factor, observer, decorators then they have a problem...

alt text
(source: headfirstlabs.com)
Check out "Head First: Design Patterns" they also have some forums regarding the book and a design meditation.

Good site for patterns http://www.dofactory.com/Patterns/PatternObserver.aspx


I think the best rule to try to follow, is KISS. Patterns are useful in helping your software be more maintainable and understandable, but ultimately KISS to ensure that people who may not have experience with all the patterns will be able to understand what your code is doing.