Boss Battles
The patterns you confuse the most. Fight each pair until the difference is burned in.
Both swap behavior via composition. One changes based on client choice, the other based on internal state.
One creates a single product via subclassing. The other creates families of related products.
One is a method with a switch. The other uses inheritance to defer creation to subclasses.
One builds step by step. The other creates in one shot.
One wraps one class to match an interface. The other simplifies a whole subsystem.
One changes the interface. The other keeps the interface but adds behavior.
Both wrap an object. Decorator adds behavior. Proxy controls access.
Observer is one-to-many notification. Mediator centralizes complex communication between peers.
Observer has direct coupling between subject and observers. Pub-Sub has a broker in between.
Both encapsulate behavior. Command is about actions (do/undo/queue). Strategy is about algorithms (swap at runtime).
Template uses inheritance to vary steps. Strategy uses composition to vary the whole algorithm.
Both have recursive structure. Composite models part-whole trees. Decorator wraps to add behavior.
Adapter fixes an existing mismatch. Bridge is designed upfront to separate abstraction from implementation.
Both chain objects. CoR can stop early. Decorator always passes through and adds behavior.
Classic Singleton controls its own lifecycle. DI-managed singletons are created by the container.
Inheritance is is-a (fixed at compile time). Composition is has-a (flexible at runtime).
DI is a technique. IoC is a principle. DIP is a SOLID rule. They are related but not the same.