Design Patterns
Design patterns are reusable solutions to recurring problems in software architecture and object-oriented design. They provide shared vocabulary and proven structural templates — like factories, observers, and strategies — that make code more flexible and easier to communicate about.
itSoftware engineering | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic: Design Patterns
A design pattern is a name for a recurring software problem and an arrangement that has helped contain it. It is not a box of finished code, although it is frequently found near boxes of finished code looking guilty by association. The point is to adapt roles and relationships to the system in front of you.
Software keeps changing its mind. A pricing rule gains another policy. A useful component arrives with an incompatible interface. Optional behavior starts accumulating around one service. Without a boundary, those changes tend to collect in the same class or conditional until it becomes a small museum of former decisions.
The first useful question is about variation: what changes independently while the rest should remain stable? A pattern gives that variation an owner. Strategy puts interchangeable behavior behind one contract. Adapter translates an interface at a boundary. Decorator preserves an interface while wrappers add responsibilities. Factory Method separates a creation choice from the code that uses the created object.
The surprising part is that similar shapes do not mean similar jobs. Adapter and Decorator both wrap objects, but one changes the interface a client sees while the other keeps it. Strategy and State can both delegate work, but Strategy represents a selected policy and State represents behavior tied to current state and transitions. The diagram is therefore a clue, not a verdict. Software has produced enough arrows already.
Every pattern asks for payment. It may add indirection, more objects, selection logic, or lifecycle rules. Observer separates a provider from subscribers, then requires decisions about subscription lifetime, notification order, failure handling, and reentrancy. A factory that hides one stable constructor is not prudent. It is a corridor with one door.
Start with the direct design. Describe stable behavior, identify variation, assign ownership, and compare one relevant pattern by intent and consequences. Test the smallest implementation, then revisit it after a real change. If the promised variation disappears, remove the boundary. Patterns improve design conversations when they expose a trade, not when they turn vocabulary into furniture.
Read the Intro for the full map of categories and consequences. Use the Cheatsheet when comparing patterns with similar shapes. The Field Notes cover the costs that become visible once an abstraction begins meeting real requirements. The Practice reference turns this into a refactoring exercise, because patterns make more sense when code has first had the courtesy to cause a problem.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://www.pearson.com/en-us/subject-catalog/p/design-patterns-elements-of-reusable-object-oriented-software/P200000009480/9780321700698
Supports
- Canonical authorship, publication, and object-oriented scope of Design Patterns
- Catalog size of 23 patterns and its creational, structural, and behavioral organization
- Patterns as named and evaluated solutions to recurring object-oriented design problems
- https://refactoring.guru/design-patterns/what-is-pattern
Supports
- A pattern as an adaptable design concept rather than finished code
- Difference between a design pattern and an algorithm
- Intent, motivation, structure, applicability, implementation, and relationship fields in pattern descriptions
- https://refactoring.guru/design-patterns/catalog
Supports
- Membership and intent of the creational, structural, and behavioral groups
- Names of the classic patterns listed in the cheatsheet
- https://refactoring.guru/design-patterns/strategy
Supports
- Strategy intent, interchangeable algorithms, context delegation, applicability, and trade-offs
- https://learn.microsoft.com/en-us/dotnet/standard/events/observer-design-pattern
Supports
- Provider, observer, subscription, and push-notification roles
- Notification ordering, unsubscription, state payload, and alternative mechanism considerations
- https://refactoring.guru/design-patterns/adapter
Supports
- Adapter intent, interface translation, participants, object composition, and applicability
- https://refactoring.guru/design-patterns/decorator
Supports
- Decorator intent, interface-preserving wrappers, behavior composition, order, and trade-offs
- https://refactoring.guru/design-patterns/factory-method
Supports
- Factory Method intent, deferred concrete product selection, applicability, and added complexity
- https://refactoring.guru/design-patterns/relations
Supports
- Intent-based distinctions and common relationships among classic patterns
- https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection/basics
Supports
- Dependency injection as removal of hard-coded dependencies
- Service contracts, registration, provider resolution, implementations, and service lifetimes
- https://learn.microsoft.com/en-us/azure/architecture/patterns/
Supports
- Distributed-system pattern scope and technology-agnostic use
- Pattern-specific problems, considerations, examples, and trade-offs
- Reliability, security, cost, operations, and performance design forces
- https://refactoring.guru/design-patterns/history
Supports
- Pattern ideas from Christopher Alexander's 1977 work
- The 1994 GoF book and the spread of patterns beyond object-oriented design
- https://c2.com/doc/oopsla87.html
Supports
- Ward Cunningham and Kent Beck's 1987 paper applying pattern languages to object-oriented programs
- https://hillside.net/plop/archive.html
Supports
- The PLoP conference archive, including 1994 through 2005
- Writers' workshops as a pattern-community practice
- https://www.martinfowler.com/articles/designDead.html
Supports
- Evolutionary design, refactoring, and patterns in Extreme Programming
- The original article's XP 2000 presentation and 2004 publication
- https://www.martinfowler.com/books/refactoring.html
Supports
- Refactoring as small behavior-preserving transformations
- The 2018 second edition of Refactoring
- https://sandimetz.com/blog/2016/1/20/the-wrong-abstraction
Supports
- Symptoms and recovery steps for an abstraction that has accumulated conditional behavior
- https://www.jetbrains.com/help/idea/class-diagram.html
Supports
- IntelliJ IDEA UML class diagrams for classes, dependencies, implementations, and parent classes
- https://learn.microsoft.com/en-us/visualstudio/ide/class-designer/designing-and-viewing-classes-and-types?view=visualstudio
Supports
- Visual Studio Class Designer for visualizing, designing, and refactoring class relationships
- https://www.visual-paradigm.com/tutorials/flyweightdesignpattern.jsp
Supports
- Visual Paradigm guidance for modeling a design pattern with class diagrams
- https://plantuml.com/
Supports
- PlantUML as a text-based diagramming tool
- https://staruml.io/
Supports
- StarUML as a UML modeling tool
