Design Patterns – Quick Notes
Design Patterns are typical solutions to common software design problems. They are high-level
descriptions, general concepts, and act as a blueprint for solving recurring design issues.
Behavioral Design Patterns
Focus on interaction between objects, promoting effective communication and proper responsibility
assignment. These patterns help achieve loose coupling and avoid hard coding dependencies.
• Chain of Responsibility: Pass request through a chain of handlers until one processes it.
• Command: Encapsulates a request as an object.
• Mediator: Reduces direct dependencies; communication happens via mediator.
• Iterator: Traverse elements of a collection.
• Memento: Save and restore object state.
• Observer: Subscription-based notification mechanism.
• Interpreter: Represents grammar of a language.
• Template Method: Defines skeleton of an algorithm.
• State: Object changes behavior when internal state changes.
• Strategy: Choose algorithm at runtime.
• Visitor: Add new operations without modifying objects.
Creational Design Patterns
Focus on how objects are created. They improve flexibility and promote reuse of existing code.
• Singleton: Only one instance exists and is globally accessible.
• Prototype: Clone existing object instead of creating new one.
• Factory Method: Creates objects via factory method; hides creation logic.
• Abstract Factory: Creates families of related objects.
• Builder: Builds complex objects step by step.
• Object Pool: Reuses expensive-to-create objects.
Structural Design Patterns
Explain how to assemble objects and classes to create larger, flexible structures.
• Adapter: Makes incompatible interfaces work together.
• Bridge: Separates abstraction from implementation.
• Composite: Treat individual and group objects uniformly.
• Decorator: Adds new behavior dynamically.
• Facade: Provides simplified interface to complex system.
• Proxy: Placeholder or substitute for another object.