Chapter 2: The Gang of Four Families
The classic design patterns are grouped into three families. Each family focuses on a particular kind of problem that appears again and again in software. These groups help you navigate the pattern landscape by showing where each idea belongs and how patterns within a family relate to each other. By understanding the families you get a mental map that guides you when choosing a pattern for a new design challenge.
Creational Patterns
Creational patterns deal with object creation. They help you control how and when objects appear so that your code avoids brittle direct construction. These patterns let you define flexible ways to build complex objects, hide construction details or delay creation until the moment it is truly needed. The goal is to produce objects in a reliable and adaptable manner while keeping your system open to future change.
Structural Patterns
Structural patterns focus on how objects fit together. They describe ways to combine components so that the whole system becomes easier to maintain. Some patterns wrap existing objects, some connect unrelated interfaces, and others group components into hierarchies. The main theme is arrangement: these patterns give your system stable, modular structure without locking you into rigid designs.
Behavioral Patterns
Behavioral patterns describe how objects interact. They define communication flows, responsibilities and decision paths within a system. These patterns often help reduce coupling because they separate what happens from who performs the action. As a result your code becomes easier to extend because you can change behaviour without reshaping the entire structure.
Choosing the Right Category
When you face a new design problem, the family groups act like signposts. If the challenge involves constructing objects safely or flexibly, you look toward creational patterns. If you need a clean arrangement of components, structural patterns point the way. If the difficulty lies in communication, decisions or control flow, behavioral patterns carry the answer. The categories help you approach problems with intention so you do not wander through the full catalogue without direction.