I am interested in learning design patterns and would like to know what are considered top tier books in learning this subject.

Is there a book out there that's the de-facto standard for describing best practices, design methodologies, and other helpful information on design patterns? What about that book makes it special?

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

closed as off-topic by Florian Margaine, user40980, gnat, Dan Pichelman, Bart van Ingen Schenau Nov 11 '13 at 11:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Florian Margaine, Community, gnat, Dan Pichelman, Bart van Ingen Schenau
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I'm not sure if this is what you're thinking about, but I find lots of clever development stuff on Forrst. – Trey Piepmeier Sep 9 '10 at 22:11
  • 2
    How about a title of "Reference sources for design patterns" or "Design pattern resources" (since I don't mean "reference" as just "look up on demand") and move all the list stuff into the body (or remove it)? – Roger Pate Sep 25 '10 at 13:05
  • For some decent implementations, I used to take a look at the ones on dofactory (didn't buy the books though). – Steven Evers Sep 25 '10 at 22:28
  • 4
    Given this question received a complete and comprehensive answer, I've closed the other design patterns questions as duplicates of this one to designate it as the canonical Q&A and answer pair for this topic. – user8 Dec 9 '11 at 22:37

11 Answers 11

up vote 55 down vote accepted

Design Patterns: Elements of Reusable Object-Oriented Software comes very close to my definition of a canonical book on design patterns. According to its wikipedia article (emphasis mine):

The original publication date of the book was October 21, 1994 with a 1995 copyright, and as of July 2010, the book was in its 38th printing. The book was first made available to the public at OOPSLA meeting held in Portland, Oregon, in October 1994. It has been highly influential to the field of software engineering and is regarded as an important source for object-oriented design theory and practice. More than 500,000 copies have been sold in English and in 13 other languages.

Ward Cunningham, a design patterns pioneer, maintains an online catalog of the book's patterns on WikiWikiWeb. And according to the Wikipedia article on design pattern (again, emphasis mine):

Design patterns gained popularity in computer science after the book Design Patterns: Elements of Reusable Object-Oriented Software was published in 1994 by the so-called "Gang of Four" (Gamma et al.).

There are quite a few other books referenced in the same article as notable in the genre:

Of those I've read Fowler's book, it's highly influential and a good read. At certain points it's a little vague for my taste, but overall it's an enjoyable book. There's an online catalog of the patterns included in the book, with minimal descriptions.

I've also skimmed through Head First Design Patterns, and if you have read any other book of the Head First series, it's of the same high quality and as enjoyable as most books in the series:

Head First is a series of introductory instructional books to many topics, published by O'Reilly Media. It stresses an unorthodox, visually intensive, reader-involving combination of puzzles, jokes, nonstandard design and layout, and an engaging, conversational style to immerse the reader in a given topic.

The term "design pattern" is somewhat vague, as every general reusable solution can be considered a design pattern. I've always noticed a tendency to apply the label on the solutions described in one of the notable books I've listed above, and more specifically the Gang of Four and Fowler books. Design patterns do not follow a unique development process, they are normal software solutions that happen to be immensely reusable and they are extremely hard to identify.

But if you compare the online catalogs for both books with the contents of language specific books you'll notice that they are often used as templates. So I'd say that both books are very close to being canonical references, with the GoF book being the more important one from a historical perspective, even though both books are limited to object oriented programming.

  • 2
    +1. Actually i wanted to give you +5 but alas that's not allowed. – Dipan Mehta Dec 9 '11 at 3:46
  • The entire Pattern-Oriented Software Architecture series is about patterns in different types of systems - Volume 1 is about architectural patterns and patterns that cross-cut domains, Volume 2 is about concurrent systems, Volume 3 is about resource management in networked/distributed systems, Volume 4 is about distributed systems, and Volume 5 is about pattern languages as well as a reference for the other 4 volumes. Given the question, I think that Volume 5 might also be applicable, but I haven't spent too much time with it...yet. – Thomas Owens Dec 12 '11 at 15:47
  • @Yannis this one and head first generally is based on static typed languages. Are there any good books for dynamic languages like python. – ravi404 May 4 '13 at 15:09

The Gang of Four book - Design Patterns: Elements of Reusable Object-Oriented Software is probably the closest thing we have to an industry standard on design patterns.

For a more accessible introduction, Head First: Design Patterns is good too. Don't be put off by the 'trendy' cover, as it's a good read and will probably help you grasp the concepts in the GoF book a lot easier if you read it first.

Head First Design Patterns

At any given moment, somewhere in the world someone struggles with the same software design problems you have. You know you don't want to reinvent the wheel (or worse, a flat tire), so you look to Design Patterns--the lessons learned by those who've faced the same problems. With Design Patterns, you get to take advantage of the best practices and experience of others, so that you can spend your time on...something else. Something more challenging. Something more complex. Something more fun.

You want to learn about the patterns that matter--why to use them, when to use them, how to use them (and when NOT to use them). But you don't just want to see how patterns look in a book, you want to know how they look "in the wild". In their native environment. In other words, in real world applications. You also want to learn how patterns are used in the Java API, and how to exploit Java's built-in pattern support in your own code.

You want to learn the real OO design principles and why everything your boss told you about inheritance might be wrong (and what to do instead). You want to learn how those principles will help the next time you're up a creek without a design pattern.

Most importantly, you want to learn the "secret language" of Design Patterns so that you can hold your own with your co-worker (and impress cocktail party guests) when he casually mentions his stunningly clever use of Command, Facade, Proxy, and Factory in between sips of a martini. You'll easily counter with your deep understanding of why Singleton isn't as simple as it sounds, how the Factory is so often misunderstood, or on the real relationship between Decorator, Facade and Adapter.

With Head First Design Patterns, you'll avoid the embarrassment of thinking Decorator is something from the "Trading Spaces" show...

  • This. It's a very accessible read, and changed the way I approach software engineering completely. – GSto Sep 13 '10 at 14:07
  • 2
    the entire head first series are great, especially for starting devs. – Thomas Stock Sep 25 '10 at 20:27
  • 1
    I love the book, but absolutely hate the cover! A non-programmer colleague of mine walked by my office the other day, saw the book and said "Head First Designer Patterns? Are you going into the fashion business?" – Pete Oct 15 '10 at 21:01
  • @Pete Why the cover can get you into more trouble. She apparently lives a double life. fishbowl.pastiche.org/2005/08/12/… – Gordon Oct 16 '10 at 11:31

Yes, there is a well known book about design patterns: Design Patterns: Elements of Reusable Object-Oriented Software and the authors are often called "the Gang of Four" (GoF) and is referenced in almost all texts about design patterns.

  • Also Martin Fowler's book: amazon.com/Patterns-Enterprise-Application-Architecture-Martin/… – Robert Harvey Dec 8 '11 at 23:03
  • This is not a book about design patterns. It's a catalog of patterns. There's a short introduction to design patterns in the beginning, but I don't think that introduction is sufficient. – Jörg W Mittag Dec 9 '11 at 3:44
  • @JörgWMittag There's isn't a unique process of creating design patterns, design patterns are relatively small reusable solutions. Design patterns are created through the normal processes of software development, what distinguishes them is their immense re-usability. The only relevant unique process is identifying a solution as a design pattern, and catalogues do that finely. – yannis Dec 25 '11 at 14:18

Design patterns : elements of reusable object-oriented software

alt text

From wikipedia:

Design Patterns: Elements of Reusable Object-Oriented Software is a software engineering book describing recurring solutions to common problems in software design. The book's authors are Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides with a foreword by Grady Booch. The authors are often referred to as the Gang of Four, GoF, or Go4. The book is divided into two parts, with the first two chapters exploring the capabilities and pitfalls of object-oriented programming, and the remaining chapters describing 23 classic software design patterns. The book includes examples in C++ and Smalltalk.

One of the best design pattern websites around is Ward's Wiki, the very first wiki. See http://c2.com/cgi/wiki?HistoryOfPatterns for a good starting page in it.

In 1987, Ward and Kent were consulting with Tektronix's Semiconductor Test Systems Group that was having troubles finishing a design. They decided to try out the pattern stuff they'd been studying. Like Alexander who said the occupiers of a building should design it, Ward and Kent let representatives of the users (a trainer and a field engineer) finish the design.

Ward came up with a five pattern "language" that helped the novice designers take advantage of Smalltalk's strengths and avoid its weaknesses...

Ward and Kent were amazed at the (admittedly spartan) elegance of the interface their users designed. They reported the results of this experiment at OOPSLA 87 in Orlando. They wrote up a panel position, and presented at Norm Kerth's workshop on Where do objects come from? They talked patterns until they were blue in the face, and got a lot of agreement, but without more concrete patterns nobody was signing up.

Meanwhile, Erich Gamma was busy writing and reflecting about object-oriented design in ET++ as part of his PhD thesis. Erich had realized that recurring design structures or patterns were important. The question really was how do you capture and communicate them.

Bruce Anderson gave a talk at TOOLS 90 at which ErichGamma was present; Erich liked the talk. Bruce gave a paper at EcoopOopsla90 (Ottawa) and ran a BOF called Toward an Architecture Handbook where he, Erich Gamma, Richard Helm, and others got into discussions about patterns. That was the first time that Richard and Erich met, and they realized they shared common ideas about the key ideas behind writing reusable OO software.

Just prior to ECOOP'91 Erich Gamma and Richard Helm, sitting on a rooftop in Zurich on a sweltering summer's day, put together the very humble beginnings of the catalog of patterns that would eventually become DesignPatterns...

Things really got rolling at the OOPSLA workshop that Bruce ran in 1991. Coincidentally, Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides were all there; they would later become the Gang of Four that authored the Design Patterns book...

I think that the Refactoring to Patterns can be useful simply because it describes how certain desing / code can be refactored towards patterns in the GoF book. This may help to overcome the initial learning curve. Oh and it also contemplates on 'Pattern-happiness' :)

You may also find the first three volumes of Pattern-Oriented Software Architecture to be a good read.

Design Patterns

This tutorial site contains following sub-sections

  • Intent of each design pattern
  • Real World Structure for the design pattern
  • A Problem statement
  • Detailed discussion on the problem
  • Checklist on how to arrive at a pattern
  • Rules of thumb while arriving at pattern.
  • Code snippets for the design pattern which includes C#, C++, Delphi, Java and PHP

This site also contains guide on Anti Patterns, UML and Refactoring.

  • The SourceMaking site looks simplistic at first glance, but it's really a great reference. Aside from the design patterns, some of the development, architecture & project management antipatterns are hilarious. The refactored solutions can actually help you save a meeting that's going off the rails. (Not bad for a design pattern reference) – Whatever Oct 25 '10 at 18:34

"Agile Principles, Patterns, and Practices in C#" by Robert C. Martin. I think he has a Java version of the book as well.

Also, not a pattern itself, but Domain Driven Design has some great concepts even if you don't go for the full DDD approach.

  * Ubiquitous Language
  * Code first approach (vs. DB first)
  * etc.

If you are interested specifically in design patterns in C++ try Modern C++ Design by Andrei Alexandrescu.

This book talks about how to implement commonly used patterns like Factory, Singleton, and Visitor in C++. It also talk about very C++-specific topics such as smart pointers, template metaprogramming, and policy-based class design.

Book author is an authoritative expert, known for his

pioneering work on policy-based design implemented via template metaprogramming. These ideas are articulated in his book Modern C++ Design and were first implemented in his programming library, Loki. He also implemented the "move constructors" concept in his MOJO library. He contributed to the C/C++ Users Journal under the byline "Generic<Programming>"...

  • 1
    would you mind explaining more on what it does and what it's good for? "Link-only answers" are not quite welcome at Stack Exchange – gnat Apr 30 '13 at 7:25
  • @gnat: how's this? – Dima Apr 30 '13 at 13:03
  • well your recent edit certainly looks an improvement to me. Though readers of the answer would probably benefit from a more detailed explanation of who is Aleksandresku – gnat Apr 30 '13 at 14:57
  • @gnat: since you obviously know who he is, please feel free to edit my answer. – Dima Apr 30 '13 at 17:15

The original book, "Design Patterns: Elements of Reusable Object Oriented Software" is a good resource for object oriented design patterns.

There exist many other books out there. When I need a quick reference and my GoF book is out of reach, Wikipedia normally has enough information on those and other design patterns.

Those are the primary ones I use. It should also be noted that people have started applying the pattern format to other things, such as project management.

If you want to know about antipatterns, which you should be aware of, there's two books, "AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis" as well as "Refactoring: Improving the Design of Existing Code" which has a section on code smells, another name for antipatterns.

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