Java Omnibus
OOAD & Architecture / GoF patterns / GoF Patterns Overview and Catalog
GoF Patterns Java Order Management
GoF Patterns

GoF patterns become useful when they help you solve a recurring design pressure, not when they become vocabulary you apply by reflex.

GoF patterns are most helpful after you already understand responsibilities, principles, process, UML, and anti-patterns. At that point, patterns stop looking like abstract names and start looking like reusable responses to recurring design pressure. This catalog is organized to support that kind of judgment rather than memorization.

Why This Topic Matters

Why it matters in real Java systems

In the Order Management domain, object creation, integration boundaries, optional behavior, workflow variation, and state-driven logic all appear naturally. GoF patterns matter because they offer repeatable structural moves when those pressures become real.

Core Explanation

The design lens behind this page

The GoF catalog is best treated as a toolbox of recurring responses rather than as a syllabus of patterns to memorize. Each pattern earns its place because a recurring problem shows up across systems: object creation becomes awkward, variation grows, collaborators become too entangled, or behavior needs to shift more cleanly than conditionals allow.

For Java developers, GoF patterns are especially useful because the language and ecosystem make these pressures very visible. Interfaces, composition, runtime wiring, and workflow-heavy services all create opportunities where a pattern can either reduce complexity or introduce needless indirection.

The real skill is not naming a pattern after the fact. It is recognizing when the forces in front of you match the problem the pattern was meant to solve.

Concept Breakdown

Key ideas to hold onto

Concept

Creational

Creation patterns help when object construction rules and configuration are becoming too tangled for constructors alone.

Concept

Structural

Structural patterns help when integration, composition, wrappers, or interface alignment are becoming design concerns.

Concept

Behavioral

Behavioral patterns help when variation in workflow, communication, state, or request handling becomes central to the design.

Java Example

Java example in the Order Management domain

Java example: one flow with multiple pattern pressures already visible
package org.javaomnibus.ecommerce.gof;

public final class PlaceOrderUseCase {
    private final PaymentGatewayFactory paymentGatewayFactory;
    private final DiscountPolicy discountPolicy;
    private final NotificationPublisher notificationPublisher;

    public PlaceOrderUseCase(
        PaymentGatewayFactory paymentGatewayFactory,
        DiscountPolicy discountPolicy,
        NotificationPublisher notificationPublisher
    ) {
        this.paymentGatewayFactory = paymentGatewayFactory;
        this.discountPolicy = discountPolicy;
        this.notificationPublisher = notificationPublisher;
    }

    public OrderReceipt handle(Order order) {
        PaymentGateway paymentGateway = paymentGatewayFactory.forMethod(order.paymentMethod());
        Money finalTotal = discountPolicy.apply(order, order.total());
        paymentGateway.authorize(finalTotal);
        notificationPublisher.publishOrderConfirmed(order);
        return new OrderReceipt(order.id());
    }
}
Code Walkthrough

Step by step

  1. Gateway selection already hints at creational pressure.
  2. Discount variation hints at Strategy-style behavioral pressure.
  3. Notification publishing may later align with Observer or event-driven collaboration.
  4. This is why the best pattern conversations start from pressure in real code rather than from catalog memorization.
Real-World Usage

Where this helps in practice

  • Teaching teams how the GoF families relate to real design forces
  • Architecture reviews where patterns need to be discussed as trade-offs rather than labels
  • Helping developers connect OOAD theory to familiar Java code shapes
Traceability Matrix

Traceability Matrix

The catalog below connects each GoF pattern back to the OOAD concept that most strongly explains its shape. The bold idea is not that a pattern uses only one pillar; it is that every pattern has a dominant design mechanism and a few supporting concepts. That gives you traceability in both directions: from OOAD concept to pattern, and from pattern back to the design force it addresses.

OOAD concept What it mainly explains Primary GoF patterns Read deeper
Composition Assembling behavior from collaborators instead of growing rigid inheritance trees. Abstract Factory, Builder, Adapter, Bridge, Composite, Decorator, Proxy, Chain of Responsibility, Observer, State, Strategy Inheritance vs Composition
Inheritance Specializing a stable parent contract or algorithm skeleton through subclasses and overrides. Factory Method, Interpreter, Template Method Inheritance vs Composition
Encapsulation Protecting invariants, hiding internal representation, and placing state transitions behind boundaries. Singleton, Facade, Flyweight, Command, Iterator, Memento, Mediator Abstraction and Encapsulation
Abstraction Depending on contracts and roles instead of concrete classes or subsystem details. Factory Method, Abstract Factory, Bridge, Facade; supports most interface-driven patterns Interfaces and Abstract Classes
Polymorphism Letting runtime types, strategies, visitors, or cloned prototypes supply behavior behind a stable call. Visitor, Prototype; supports Strategy, State, Command, Observer, Adapter, Decorator, and many others Polymorphism in Depth
Type lens: creational patterns often read like nouns or makers, structural patterns often read like adjectives or object shapes, and behavioral patterns often read like verbs or reified actions. The exceptions are useful too: Command is a verb turned into a noun, while Composite, Facade, and Flyweight are structural nouns.
Pattern Family Type lens Defining OOAD concept Supporting concepts Details
Factory MethodCreationalNoun: makerInheritancePolymorphism, AbstractionOpen
Abstract FactoryCreationalNoun: kitCompositionPolymorphism, AbstractionOpen
BuilderCreationalNoun: assemblerCompositionEncapsulationOpen
PrototypeCreationalNoun: exemplarPolymorphismEncapsulationOpen
SingletonCreationalNoun: the oneEncapsulationControlled constructionOpen
AdapterStructuralAdjective: compatibleCompositionPolymorphismOpen
BridgeStructuralNoun: spannerCompositionAbstraction, PolymorphismOpen
CompositeStructuralNoun: treeCompositionPolymorphismOpen
DecoratorStructuralAdjective: wrappedCompositionPolymorphismOpen
FacadeStructuralNoun: front doorEncapsulationAbstractionOpen
FlyweightStructuralAdjective: sharedEncapsulationIdentity/state separationOpen
ProxyStructuralAdjective: stand-inCompositionPolymorphismOpen
Chain of ResponsibilityBehavioralVerb: passCompositionPolymorphismOpen
CommandBehavioralNoun from verbEncapsulationPolymorphismOpen
InterpreterBehavioralVerb: evaluateInheritancePolymorphismOpen
IteratorBehavioralVerb: traverseEncapsulationPolymorphismOpen
MediatorBehavioralVerb: coordinateEncapsulationCompositionOpen
MementoBehavioralNoun: snapshotEncapsulationState captureOpen
ObserverBehavioralVerb: notifyCompositionPolymorphismOpen
StateBehavioralVerb: behave-asCompositionPolymorphismOpen
StrategyBehavioralVerb: do it this wayCompositionPolymorphismOpen
Template MethodBehavioralVerb: procedureInheritancePolymorphismOpen
VisitorBehavioralVerb: operatePolymorphismDouble dispatchOpen

Pattern catalog by GoF family

How To Use This Page

Read by force, not by family name

Start with Creational when object construction hurts, Structural when wrappers or subsystem boundaries hurt, and Behavioral when workflow or collaboration logic becomes the problem. All three GoF families are now live in this vertical.

Trade-Offs

When to be careful

Pattern catalogs can create false confidence if a team treats them as solutions in search of problems. Use the catalog as a diagnostic map, not as a mandate to abstract aggressively.

Common Mistakes

Frequent mistakes to watch for

  • Learning the names without learning the forces behind them
  • Applying patterns before the problem has stabilized enough to justify them
  • Treating frameworks as if they automatically remove the need for pattern judgment
  • Thinking every clean design must correspond to a named GoF pattern
Related Pages

Related concepts


What To Read Next