Design Patterns

Common software design patterns: creational, structural and behavioral

Creational Patterns

Singleton # ensure only one instance exists
Factory Method # create objects without specifying class
Abstract Factory # create families of related objects
Builder # construct complex objects step by step
Prototype # clone existing objects

Structural Patterns

Adapter # convert interface to another interface
Bridge # separate abstraction from implementation
Composite # tree structure of objects
Decorator # add behavior to objects dynamically
Facade # simple interface to complex system
Proxy # placeholder for another object

Behavioral Patterns

Strategy # define family of algorithms
Observer # notify dependents of changes
Command # encapsulate request as object
State # change behavior when state changes
Template Method # define algorithm skeleton
Iterator # access elements sequentially

More Behavioral

Chain of Responsibility # pass request along chain
Mediator # centralize complex communications
Memento # capture and restore object state
Visitor # add operations without changing classes

SOLID Principles

S - Single Responsibility # one reason to change
O - Open/Closed # open for extension, closed for modification
L - Liskov Substitution # subclasses must be substitutable
I - Interface Segregation # many specific interfaces
D - Dependency Inversion # depend on abstractions