GoF Design Patterns: Introduction — Pattern Structure, MVC Case Study, and Catalog Organization

This chapter introduces the concept of design patterns in object-oriented software, defines the template used to describe each pattern, walks through MVC as a motivating example of multiple patterns working together, catalogs all 23 GoF patterns with one-line intents, and classifies them by purpose (creational/structural/behavioral) and scope (class/object). It also begins discussing how patterns solve fundamental OO design problems: finding appropriate objects, determining granularity, specifying interfaces, and specifying implementations.

Key Concepts

Commands and Syntax

Pattern description template (13 sections):

1. Pattern Name and Classification — succinct name + purpose/scope category

2. Intent — what it does, rationale, which problem it addresses

3. Also Known As — alternative names

4. Motivation — illustrative scenario

5. Applicability — when to apply, how to recognize the situation

6. Structure — OMT class diagrams + interaction diagrams

7. Participants — classes/objects and their responsibilities

8. Collaborations — how participants work together

9. Consequences — trade-offs, what can vary independently

10. Implementation — pitfalls, hints, language-specific issues

11. Sample Code — C++ or Smalltalk fragments

12. Known Uses — at least two real-system examples from different domains

13. Related Patterns — differences and complementary usage

Classification matrix (Purpose x Scope):

| | Creational | Structural | Behavioral |

|---|---|---|---|

| Class | Factory Method | Adapter (class) | Interpreter, Template Method |

| Object | Abstract Factory, Builder, Prototype, Singleton | Adapter (object), Bridge, Composite, Decorator, Facade, Flyweight, Proxy | Chain of Responsibility, Command, Iterator, Mediator, Memento, Observer, State, Strategy, Visitor |

Relationships

Exam-Relevant Points