Structural Design Patterns
Patterns for composing classes and objects into larger structures. These patterns make it easier to assemble systems from independent parts while keeping them decoupled.
Adapter Pattern: Making Incompatible Interfaces Work Together
How to make two incompatible interfaces work together without touching either one, using object adapters, class adapters, and two-way adapters.
Facade Pattern: A Simple Entry Point to a Complex Subsystem
How to give callers one convenient entry point into a complex subsystem, without hiding it, and where Facade turns into a leaky-abstraction anti-pattern.
Decorator Pattern: Adding Behavior Without Subclassing
How to attach new behavior to individual objects dynamically, the way java.io streams do, without subclass explosion — and how to chain decorators correctly.
Proxy Pattern: Controlling Access to an Object
Virtual, protection, and remote proxies for controlling access to an object — lazy loading, authorization checks, and network boundaries — plus Java's dynamic proxy mechanism.
Bridge Pattern: Decoupling Abstraction from Implementation
How to let an abstraction and its implementation vary independently, using composition instead of a combinatorial inheritance hierarchy.
Composite Pattern: Treating Trees and Leaves Uniformly
How to compose objects into tree structures representing part-whole hierarchies, so clients can treat individual objects and compositions of objects through one interface.
Flyweight Pattern: Sharing State to Cut Memory Usage
How to minimize memory usage by sharing intrinsic state across millions of similar objects, using a flyweight factory, and when the added complexity is actually worth it.