Sunday, 17 June 2018

Structural Patterns

  • Adapter
    converts the interface of a class into another interface that clients expect.
  • Bridge
    Separates an object's interface from its implementation...(Many to Many)
  • Composite
    A tree structure of simple and composite objects
  • Decorator
    Add responsibilities to objects dynamically
  • Facade
    A single class that represents an entire subsystem
  • Flyweight
    A fine-grained instance used for efficient sharing
  • Proxy
    An object representing another object
Bridge:
The Bridge pattern decouples an abstraction from its implementation, so that the two can vary independently. A household switch controlling lights, ceiling fans, etc. is an example of the Bridge. The purpose of the switch is to turn a device on or off. The actual switch can be implemented as a pull chain, simple two position switch, or a variety of dimmer switches.
Bridge example


Proxy:
The Proxy provides a surrogate or place holder to provide access to an object. A check or bank draft is a proxy for funds in an account. A check can be used in place of cash for making purchases and ultimately controls access to cash in the issuer's accou
Proxy example






No comments:

Post a Comment