views:

173

answers:

9

I want to learn about design patterns and from what I've seen the most recommended ones are the Gang of Four's Design Patterns and Head First Design Patterns. There are also language specific books, but I never see them recommended. I suppose it ties you to whatever strengths/weaknesses are inherent to each language, so not a good idea to learn design patterns in general.

The Gang of Four's book is kinda old, so I'm wondering if there isn't a better alternative out today? I've heard the Heard First one isn't quite as good. But I'm not sure why, so it's really hard to pick either one. I've see some answers on this very site recommending both, but if I can only read one, which should I pick? I've been coding for 3+ years, though I've never had a good class on this subject.

Also, would a book like Code Complete help me with this?

One more thing: how often are these techniques supposed to be useful? For example, this question has me wondering if this stuff is worth the trouble.

And please, tell me more than just "read x". I'd like to know why you're suggesting x.

+3  A: 

First!!

Code Complete 2

Edit: The GoF book and several others, in my opinion, do not take a holistic approach to design in general, but rather maintain a repository of patterns. Design is all around us in every field. Take inspiration from real-life and the things around us. A house is just one of the infinite examples out there. Power and water supply is a cross-cutting concern that extends to every room. But it also has to decoupled from it's implementation (utilities provider) so you can change it anytime you want. We could use Bridge, Composition, Strategy, Decorator, or a combination of a bunch of other patterns, and unfortunately there's not always one right answer. People say the eye of looking at a problem and identifying appropriate design patterns (from a given list) comes with experience, which is very true, but with experience and training we can also do massive calculations in nothing but thin air using just our imagination. The point is that with sufficient experience we can master anything, not just design patterns.

That's all good and dandy, but where do we start? I'd recommend you take a look at A Pattern Language: Towns, Buildings, Construction. It has nothing to do with Computer Science, but design in general and was the inspiration behind the GoF book.

Anurag
+2  A: 

Second!

Pragmatic Programmer

alt text

Design Patterns

Developer Art
+1  A: 

Read Code Complete before even touching the Gang of Four.

Tuomas Pelkonen
Design patterns should not be used until you know how program and do design without them. This will take years, but diving straight into design patterns will produce overly complex code and putting design patterns in places where they are not supposed to be.
Tuomas Pelkonen
+3  A: 

There are a lot of goot books on software design and patterns. I recomment to read Martin Fowler's books (http://martinfowler.com/) and +1 to Code Complete2 and pragmatic programmer.

Andrew Bezzub
Fowler has some good books, just be careful because a lot of it is very "only one right way" which can be off putting for someone just learning the ropes.
GrayWizardx
+3  A: 

Head First Design Patterns is a very good book. The examples in the book come in Java, and I remember that you can download all the examples in C#

Digicoder
+2  A: 

I want to recommend Domain-Driven Design by Eric Evans.

klausbyskov
And then follow up that book with Applying Domain-Driven Design and Patterns: With Examples in C# and .NET by Jimmy Nilsson
Digicoder
A: 

I have just read Head First Design Patterns book and it's great! It is very easy to read and interesting for those who hasn't worked with patterns before and dislikes 1000-pages manuals. All the examples are relevant and explanations are pretty clear. But yeah, if you are a serious experienced professional working in a tie and taking care of your reputation in the eyes of as serious guys as you, don't read it in the office, it's too thin for it, it has a bright cover and a lot of pictures, hand-writing fonts and cartoon-styled arrows inside. And it will sure make you laugh out loudly while others are writing their code nearby. If it's your case, read GoF book and you'll get all the respect from your co-workers. In other case read Head First book beforehand. And in either case read Code Complete 2 first. Not for understanding design patterns as is but for all the other issues that are even much more important.

Dzmitry Zhaleznichenka
A: 

Think it was mentioned discreetly by @developer art, but here's the purchase link as well:

Design Patterns: Elements of Reusable Object-Oriented Software (Hardcover)

http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612

ajhit406