Skip to content

Latest commit

 

History

History
89 lines (55 loc) · 4.47 KB

File metadata and controls

89 lines (55 loc) · 4.47 KB

Structural Design Patterns

Structural design patterns explain how to assemble objects and classes into larger structures while keeping these structures flexible and efficient.

One Shot Video: Structural Design Patterns in One Shot

Summary

Structural design patterns focus on how classes and objects are composed to form larger structures, ensuring that if one part changes, the entire structure doesn't need to do the same. They help ensure that systems are easier to design, understand, and maintain.

Overview of Structural Patterns

  1. Decorator - Allows behavior to be added to individual objects dynamically without affecting other objects from the same class
  2. Proxy - Provides a surrogate or placeholder for another object to control access to it
  3. Composite - Composes objects into tree structures to represent part-whole hierarchies
  4. Adapter - Allows the interface of an existing class to be used as another interface
  5. Bridge - Decouples an abstraction from its implementation so that the two can vary independently
  6. Facade - Provides a unified interface to a set of interfaces in a subsystem, making it easier to use
  7. Flyweight - Reduces the cost of creating and manipulating a large number of similar objects by sharing as much data as possible

1. Decorator Pattern

Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.


2. Proxy Pattern

Provide a surrogate or placeholder for another object to control access to it.


3. Composite Pattern

Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.


4. Adapter Pattern

Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.


5. Bridge Pattern

Decouple an abstraction from its implementation so that the two can vary independently.


6. Facade Pattern

Provide a unified interface to a set of interfaces in a subsystem. Facade defines a high-level interface that makes the subsystem easier to use.


7. Flyweight Pattern

Use sharing to support large numbers of fine-grained objects efficiently.