2.3. Design Patterns

If you have been programming for any length of time, chances are you have heard the term design patterns.

The history of design patterns goes back as far as 1977, when Christopher Alexander originally developed them as an architectural concept. (In architecture, patterns refer to the idea of capturing architectural design ideas as archetypal and reusable descriptions.)

In 1987, Kent Beck and Ward Cunningham began applying the concept of patterns to programming and presented their results at the Object Oriented Programming, Systems, Languages and Applications (OOPSLA) conference that year.

While design patterns have been around for some time, they started gaining popularity in computer science after the publishing of the book Design Patterns: Elements of Reusable Object-Oriented Software (Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides: Addison-Wesley, 1994) commonly referred to as the gang of four (GOF) book.

The GOF book is generally considered the "canonical" text on design patterns. According to this book, design patterns can be broken into four essential elements:

  • Pattern name

  • Problem

  • Solution

  • Consequences

The pattern name is a way of referring to and describing a design problem, its solution, and the solution's consequences. In other words, it is a simple way of referring to the collection of the other three parts.

The problem describes when to apply a given pattern. This description may be a specific design problem such as how to represent ...

Get Professional Cairngorm™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.