Design Patterns  «Prev  Next»
Lesson 6Three Types of Design Patterns
ObjectiveDistinguish Behavioral, Creational, and Structural patterns and recognize when to apply each category.

Three Types of Design Patterns

GofPatterns

The Gang of Four (GoF) organize design patterns into three groups—Creational, Structural, and Behavioral. Each group addresses a different source of complexity in software systems: object creation, object composition, and object collaboration. This page summarizes what each group solves, the trade-offs involved, and representative patterns.

Creational (Object Creation) Factory, Builder, Singleton Structural (Object Composition) Adapter, Composite, Proxy Behavioral (Object Collaboration) Observer, Strategy, Mediator Lifecycle Flow: Create → Assemble → Interact

Creational Patterns

Problem they solve: How to create families of related objects without coupling code to concrete classes.

Why they matter: Centralize construction logic, delay decisions about concrete types, enable configurability and testing.

Analogy: A restaurant kitchen (factory) prepares meals for customers without requiring them to know how each dish is made.

Structural Patterns

Problem they solve: How to compose classes and objects to form larger structures while keeping those structures flexible.

Why they matter: Promote reuse by composing behavior from simpler parts; provide uniform interfaces over disparate components.

Analogy: An electrical adapter lets a U.S. plug fit into a European socket, enabling compatibility without changing either device.

Behavioral Patterns

Problem they solve: How objects communicate, distribute responsibilities, and vary algorithms without tight coupling.

Why they matter: Clarify control flow, encapsulate algorithms, and decouple senders from receivers.

Analogy: A theater director (mediator) coordinates actors, ensuring smooth interaction without requiring the actors to manage all communications themselves.

How to Choose

Quick Reference

Next Steps

Use this page as a map. When facing a design problem, first identify whether you are struggling with creation, composition, or collaboration, then select candidate patterns from the corresponding group for deeper study.

[1] Polymorphism: In design patterns, polymorphism allows objects of different classes to be treated as objects of a common type. This enables you to write code that can work with a variety of objects without knowing their exact class, promoting flexibility and maintainability.
SEMrush Software 6 SEMrush Banner 6