adapter DP(Class-Structural DP)• What• A design that enables a noncompliant interface to be usedthrough an intermediary, which manages an adaptationprocess to effect compliance.• Where• A requirement to integrate with a noncompliant interface or arequirement for one design to leverage the functionality ofanother design.• Why• To reuse or integrate existing functionality, or adapt to changein business requirements that necessitates reengineeringdesign or functionality.• How• An intermediary class is used to map the desired functionalityfrom the source interface to that required by the target
Bridge DP(Object – Structural DP)• What• Decouple an abstraction from its implementation so thatthe two can vary independently.• Avoid a permanent binding between an abstraction andits implementation or to hide implementation from client• Why• Decoupling interface and implementation.• How• Abstraction forwards client requests to its Implementorobject.
• Example• A bank Account may be a saving or a currentaccount. A bank account may also be astudent account or a child account or anormal account• Note that:• Abstract Factory can create a particularBridge• Assignment: Show how can this bedone?Bridge DP(Object – Structural DP)
Bridge Vs. Adapter• Bridge DP:• Meant to separate an interface from itsimplementation, to vary easily andindependently• Adapter DP:• Meant to change the interface of an existingobject• It is applied to systems after they’re designed.• Makes unrelated classes work together.
Composite DP(Object – Structural DP)• What• A design that ensures that an entity and a composite ofentities expose the same interface.• Where• A requirement to treat simple and composite objects alike• Why• To organize entities into hierarchies, that contain singleentities and composite entities• How• A common interface is inherited by a composite and anentity
decorator DP(Object – Structural DP)• What• Attach additional responsibilities to an objectdynamically.• Where• To add responsibilities to individual objects dynamically,without affecting other objects.• For responsibilities that can be withdrawn.• Why• Add optional responsibilities• How• Abstraction forwards client requests to its Implementor
• Decorator & Adapter:• A decorator changes an object responsibilitywhile an adapter changes its interface• Decorator & Composite:• A decorator adds responsibility while acomposite is intended for object aggregationdecorator DP(Object – Structural DP)
Façade DP(Object – structural dp)• What• A design to hide the complexity of many interface behinda simple and uniform interface.• A requirement for a high-level abstraction that is simpleto use.• Why• Software becomes complex as it seeks to interact withmany interfaces, systems, or subsystems.• How• Managing multiple interfaces is delegated to a facadeclass that hides the complexity and presents a simpleinterface.
Proxy DP(Object – structural dp)• What• Represents or regulates access to an object that is scarce or remote.Provide a surrogate or placeholder for another object to controlaccess to it.• Where• Access needed to be regulated or access to a principal needs to bedistributed.• Why• To regulate client code access to a given resource; or for remoteaccess to functionality.• How• A proxy class is derived from the same base class as the principalclass. The proxy class uses composition—it creates a memberinstance of the principal—to expose the functionality of the principalthrough a set of wrapper methods or properties. The client codecreates an instance of the proxy class that regulates or distributesaccess to the functionality of the principal.