Design Patterns
26 topics · Stage 3
Complete
Creational6
- 01SingletonExactly one instance, reachable from everywhere2 min
- 02FactoryCreating objects without naming the concrete class2 min
- 03Abstract FactoryCreating whole families of related objects2 min
- 04BuilderObjects with many optional parts2 min
- 05PrototypeCopy an existing object instead of building a new one3 min
- 06Creational SummaryCreational patterns deal with object creation mechanisms, trying to create objects in a manner suitable to the situation.2 min
Structural8
- 01AdapterMake an incompatible interface fit2 min
- 02DecoratorAdd behaviour at runtime without subclassing2 min
- 03FacadeOne simple door in front of a complex subsystem2 min
- 04CompositeTreat a tree and a single item the same way2 min
- 05ProxyA stand-in that controls access to the real object3 min
- 06FlyweightShare common state across huge numbers of objects3 min
- 07BridgeSplit a class that varies in two directions into two hierarchies joined by a reference, so 3 x 3 combinations need 6 classes instead of 9.9 min
- 08Structural SummaryStructural design patterns deal with how classes and objects are composed to form larger structures.6 min
Behavioural12
- 01StrategySwap an algorithm at runtime4 min
- 02ObserverTell many objects when something changed3 min
- 03CommandTurn a request into an object you can queue or undo5 min
- 04StateBehaviour changes when internal state changes6 min
- 05Template MethodFix the steps, let subclasses fill them in5 min
- 06IteratorWalk a collection without exposing its internals3 min
- 07Chain of ResponsibilityPass a request along a chain until one handler takes it5 min
- 08MementoSave and restore an object's state1 min
- 09MediatorObjects stop calling each other directly and go through one coordinator, so n objects need n links instead of n x (n - 1).9 min
- 10VisitorPull operations like GST, shipping and invoice export out of your item classes, so a new operation is a new class and the items never change.9 min
- 11InterpreterModel rules like "cartTotal > 499 AND city == Bengaluru OR isPrime" as a tree of small expression objects, so changing an offer means changing data, not code.8 min
- 12Behavioural SummaryAll eleven behavioural patterns on one page, with a decision tree for picking one and the pairs interviewers love to mix up, like Strategy vs State.8 min