Skip to content

Latest commit

 

History

History

structural-design-pattern

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
alt tag alt tag alt tag alt tag alt tag alt tag alt tag
Design Pattern Definition Purpose How to Use
Adapter Allows incompatible interfaces to work together Reuse or make two incompatible classes work together Create an adapter class that implements the desired interface and wraps an instance of the incompatible class.
Bridge Separates abstraction from implementation Decouple abstraction and implementation Create abstraction and implementation hierarchies and bridge them using composition.
Composite Represents part-whole hierarchies Create a hierarchical structure of objects Define a common interface for leaf and composite objects and implement the pattern using composition.
Decorator Dynamically adds responsibilities Extend functionality of individual objects Create decorator classes that wrap objects and add behavior.
Facade Provides a simplified interface to subsystems Simplify complex subsystem interactions Create a facade class that encapsulates interactions with the subsystem.
Flyweight Shares common state among objects Efficiently support a large number of similar objects Identify intrinsic and extrinsic properties; create a factory to manage shared intrinsic properties.
Proxy Provides a surrogate or placeholder Control access, add functionality, or implement lazy loading Create a proxy class that implements the same interface as the real object and forwards requests.