Chapter 2. Dissecting the Pattern's Pattern
WHAT'S IN THIS CHAPTER?
How to read GoF design patterns using the design templates
Learning and understanding the design pattern groupings
Knowing how to choose and apply a design pattern
A quick example on refactoring existing code to use design patterns and principles to increase maintainability
Many books on the market give an overview and a template for individual design patterns but leave it up to the developer to learn how to decipher and apply the pattern. In this chapter, you will gain the practical knowledge necessary to use a design pattern solution template and apply it to your code base. You will then learn about the 23 design patterns and the groups they belong to. Finally, you will run through a quick exercise in which you will implement some design principles and patterns that you have read about.
HOW TO READ DESIGN PATTERNS
In the original design patterns book by the Gang of Four, each pattern was presented in a pattern template. The idea behind the pattern template was to enable the reader to decipher a pattern and learn about what set of problems it was designed to solve. In this book, I use a simplified version of the GoF pattern template to describe the GoF patterns, Fowler's enterprise patterns, and the S.O.L.I.D. design principles.
Gang of Four Pattern Template
The GoF book described each pattern using the following template:
Pattern Name and Classification: The Pattern Name is important because it helps to form the common ...