Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Possible Duplicate:
Is there a canonical book on design patterns?

I'd like to read a design patterns book. GoF for sure is the one to read. But after 15 years is it still valid, I mean isn't there an updated one?

Something like "Charles Darwin On the origin of species" is a very important book, and some main concepts are still valid, anyway today (2010) one would read another book to study the subject.

In this question the main suggestions are the Head First and GoF books. But Head first is not a replacement for GoF.

So any suggestion or should I stick with GoF?

share|improve this question

marked as duplicate by Mark Trapp Dec 9 '11 at 22:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
What I would like to know is "How" to read it. I bought it and thought it was going to be awesome with its cool Sacramentary style ribbon bookmarks, but it's a very hard nut to crack and apply to everyday coding, especially when no one you work with even cares about the pearls within. –  Peter Turner Oct 19 '10 at 1:49
    
thanks to all for the replies. –  user193655 Oct 21 '10 at 19:32

8 Answers 8

up vote 12 down vote accepted

I recommend reading the Head First book first, as it does a better job of explaining why design patterns are needed. After that, you can use the GoF book for examples and as a reference.

share|improve this answer
3  
I bought them both, they shipped today. In the mean time I am half way through FOwler's refactoring. I bought it 3 years ago, but i was too a beginner to understand it. Now I can understand and I am ready to tackle the legacy Delphi application I am maintaining and attack it with unit tests and refactorings. THis is why i want also to know more on design patterns. I also ordered Michal Feather's book on Legacy applications. –  user193655 Oct 21 '10 at 19:25

I fear the day the patterns in that book will not exist anymore. That day is likely never to come. Get the book.

share|improve this answer
5  
However, most of the patterns fits best for object oriented programming. If you are into functional programming the patterns in the book isn't that useful. –  Jonas Oct 18 '10 at 19:40
    
@Jonas: good point indeed. But still, no matter what type of programming you do most, you always benefit from knowing how to spot patterns and this book certainly helps in learning that. –  stijn Oct 18 '10 at 20:01
    
The patterns will likely exist, but may become language/framework features (observer, iterator, etc. in .NET for instance). –  Steve Evers Oct 18 '10 at 21:32
    
@Jonas I am in "Object Functional Oriented programming". Means I have a legacy application written in Object Pascal, written by people that didn't know about OOP, for whom objects are just containers of procedures. Anyway the goal I have is to make it maintainable, to refactor some core areas, and see if I can survive. Now it is quite a lot spaghetti code, procedural code, at least 4 different teams worked on it. Function names with wrong or misleading names "like a function that zips a file is called "ZipUnzip"".... Terrible ground. But now I want to tackle this task and stop crying... –  user193655 Oct 21 '10 at 19:28
    
Except for Object Pascal, this nicely describes more than one project I've been "blessed" to work on. –  DarenW Nov 12 '10 at 1:19

Stick with the GoF. In addition, I'd suggest you read the following:


Steven John Metsker's "Design Patterns Java(TM) Workbook" (ISBN 0201743973)

I think this book is a nice complement to the GoF or it could be safely used instead of the GoF if you are learning or working with Java. Similar books exist for other languages like C# and Ruby, but I cannot attest of their quality since I have not read them.


William C. Wake's "Refactoring Workbook" (ISBN 0321109295)

Refactoring goes hand in hand with patterns. This one is a nice workbook to read.


Brown et al "AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis" (ISBN 0471197130)

The other side of the coin are anti-patterns, code smells that scream for refactoring. This book is good (at least the first half that deals with software-related anti-patterns.)


Craig Larmans' "Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development (3rd Edition)" (ISBN 0131489062)

Larman's book is pretty much becoming a de-facto preferred textbook for undergrad courses in software engineering and systems analysis. It does a good work in walking through the utilization of UML and patterns in an iterative process.


Chris Okasaki's "Purely Functional Data Structures" (ISBN 0521663504)

I would consider this book once you have developed a good working knowledge of patterns, anti-patterns and re-factoring. It is a theoretical treatise of patterns and data structures from a purely functional point of view.

One of the things with the GoF (and books that carry that baton) is that those patterns are the product of an era where generic programming was finally being realized in C++. The patterns presented therein existed to accommodate a OO and procedural/algorithmic paradigm.

Several of these patterns (visitor for example) don't have much of a reason to exist in languages that treat functions as first-class objects. I would not touch this book without a good grasp of patterns and functional languages, though

share|improve this answer
    
Yep, Okasaki's excellent little book is pretty hardcore - it's not really in the same category as the others IMHO being much more of a theoretical book. –  FinnNk Oct 18 '10 at 21:15
    
Thanks for the suggestions, I read Larman's book, a very nice read, I read Fowler's for refactoring and I am reading "The art of unit testsing with examples in .net" + I ordered a couple of books on TDD. I will study your list and keep in my wish list. –  user193655 Oct 21 '10 at 19:30

You will still need it. You will keep coming back to it for double checking and small revisons and good examples. Keep it on your shelf. If you are a starter pick up Head First. On the contrary I am very interested in finding out a book which is rated higher than GOF :-)

share|improve this answer

Definitely one to keep a copy of around. I've had the GoF book since I first started in software and find it's once one of those books that I get more out of every time I re-read it (and no, I don't read the whole thing cover-to-cover - just the odd pattern here and there). It is, however, one of those books that I felt as a "beginner", I never got as much out of it as i did later in my career. I found that having more experience makes the book a much more interesting and, of course, more relevant.

share|improve this answer
    
good point. When I first read through it I hardly knew what a class was (didn't get any programming education), and I was like 'wow I can see this is all very important but I don't understand it enough to put to use'. The more I read it, the better it gof lol. –  stijn Oct 19 '10 at 6:17

go for the Head First. it explains how you write code the usual way, what the problem would be with a modification not done the right way, the design principle to apply, the refactor and then points the result to what pattern you just used.

i found the design principles most useful. would not have bothered with the patterns if the principles weren't explained

share|improve this answer

It depends heavily on your scope. If you are more of an enterprise Java/C# or hardcode C++ type then yes, go get a GoF and probably some other books on the topic too (see other answers). However, if you can imagine working in a dynamic language with higher order functions and more advanced concepts, you mostly won't need any of those patterns. Even worse: you'll get less productive since you'll be looking for patterns to implement instead of thinking in language terms and (ab)using its power. Looking at Python, Ruby, (modern) Perl, Erlang, Scala, Clojure, Lisp, you name it, in every one of those languages no patterns from GoF are needed, since frankly, the patterns are a good way to solve some problems inherent to languages without higher-order constructs.

That being said, learn the patterns anyway either way, but be critical of them and learn to use them properly and sparingly. They are not the silver bullet and never going to be.

share|improve this answer
    
This is a very interesting answer. For me this is a totally new coincept. I am a Delphi developer (so somehow facing the same problems that java/c# developers face), but I am interested in learning new things. May you please shed some more light (maybe giving me a reference to a link) on " the patterns are a good way to solve some problems inherent to languages without higher-order constructs"? Thanks. –  user193655 Nov 2 '10 at 13:44
    
@user5396: A classic one is by Peter Norvig: norvig.com/design-patterns, which is by the way 12 years old. According to him, 16 of 23 patterns in the GoF book are much simpler in dynamic languages. I would recommend reading Practical Common Lisp (available at gigamonkeys.com/book) and maybe Higher Order Perl (hop.perl.plover.com) to see what a proper dynamic language is capable of. –  Nikolai Prokoschenko Nov 2 '10 at 14:14
    
Thanks for the links. My first feeling is that if one doesn't need super control of algorithm details it makes more sense to develop with these kinds of languages. I can imagine that the current scenario is too many people using Java/c#/Delphi while they could be more productive in Python and Co. Am I correct? –  user193655 Nov 2 '10 at 15:55
    
@user5396: depends a bit on people's training, since if they are trained to a Java mindset, they'd probably be less productive with e.g. Python, producing anti-pythonical solutions. I don't fully understand what you've meant by "super control of algorithm", but there should be no controlling problems with either programming language. –  Nikolai Prokoschenko Nov 3 '10 at 14:55

Definitely begin with GoF - but bear in mind that since it came out there are numerous books with various pattern catalogues in them (most of the 'signature' series comes to mind, such as PoEAA or Enterprise Integration Patterns) which take the pattern idea into more specific areas.

Also remember that the implementation of some of the patterns is potentially a little archaic depending on the language you're working in. For example, although you could implement the Java code pretty much as-is in C# (and that would have been fine when C# 1 was knocking about) you'd be missing out on the potential that some modern language features provide. Specifically for .net I like the examples from dotfactory, Judith Bishop's book is pretty good too.

share|improve this answer
1  
And don't forget the POSA (Pattern-Oriented Software Architecture) books either: cs.wustl.edu/~schmidt/POSA –  Frank Shearar Oct 28 '10 at 7:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.