Design Patterns
SOLID principles and all 23 Gang of Four patterns, each with a UML diagram, a runnable Java example and interview notes.
25 lessons4 modules4 advanced topics
0/25 completed
01
Principles
2 lessons02
Creational
5 lessons3beginnerSingleton PatternEnsure a class has exactly one instance and provide a global access point to it — and know when not to.4beginnerFactory Method PatternDefine an interface for creating an object, but let subclasses — or a mapping — decide which class to instantiate.5intermediateAbstract Factory PatternProvide an interface for creating families of related objects without specifying their concrete classes.6beginnerBuilder PatternConstruct complex objects step by step, avoiding telescoping constructors and producing immutable results.7intermediatePrototype PatternCreate new objects by copying a configured prototype instead of building them from scratch.
03
Structural
7 lessons8beginnerAdapter PatternConvert the interface of a class into another interface clients expect, so incompatible types can work together.9advancedBridge PatternDecouple an abstraction from its implementation so the two can vary independently — and avoid a class explosion.10intermediateComposite PatternCompose objects into tree structures and let clients treat individual objects and groups uniformly.11intermediateDecorator PatternAttach responsibilities to an object dynamically by wrapping it — a flexible alternative to subclassing.12beginnerFacade PatternProvide a simple, unified interface to a complex subsystem so clients don't need to know its internals.13advancedFlyweight PatternShare common, immutable state between many fine-grained objects to drastically cut memory use.14intermediateProxy PatternProvide a surrogate that controls access to another object — for laziness, security, caching or remote calls.
04
Behavioral
11 lessons15intermediateChain of Responsibility PatternPass a request along a chain of handlers, each deciding to process it, pass it on, or stop the chain.16intermediateCommand PatternTurn a request into a stand-alone object so you can queue, log, retry and undo operations.17advancedInterpreter PatternRepresent a simple language's grammar as classes and evaluate sentences by walking the resulting tree.18beginnerIterator PatternTraverse the elements of a collection sequentially without exposing its underlying representation.19intermediateMediator PatternReduce chaotic many-to-many dependencies by making objects communicate through a central mediator.20intermediateMemento PatternCapture and restore an object's internal state without violating encapsulation — the basis of undo and snapshots.21beginnerObserver PatternDefine a one-to-many dependency so that when one object changes state, all its dependents are notified automatically.22intermediateState PatternLet an object change its behaviour when its internal state changes — replacing sprawling conditionals with state objects.23beginnerStrategy PatternDefine a family of interchangeable algorithms, encapsulate each one, and pick the right one at runtime.24beginnerTemplate Method PatternDefine the skeleton of an algorithm in a base class and let subclasses fill in specific steps.25advancedVisitor PatternAdd new operations to an object structure without changing its classes — and how sealed types and pattern matching modernise it.