KEMBAR78
Design Patterns After Mid | PDF | Computers
0% found this document useful (0 votes)
62 views14 pages

Design Patterns After Mid

The adapter pattern converts the interface of one class into another interface that a client expects, allowing classes with incompatible interfaces to work together. It has four components: a target interface, a client, an adaptee with an incompatible interface, and an adapter that connects them. The bridge pattern decouples an abstraction from its implementation so they can vary independently. It has an abstraction class, refined abstractions, an implementation interface, and concrete implementations.

Uploaded by

Ayesha Ashraf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views14 pages

Design Patterns After Mid

The adapter pattern converts the interface of one class into another interface that a client expects, allowing classes with incompatible interfaces to work together. It has four components: a target interface, a client, an adaptee with an incompatible interface, and an adapter that connects them. The bridge pattern decouples an abstraction from its implementation so they can vary independently. It has an abstraction class, refined abstractions, an implementation interface, and concrete implementations.

Uploaded by

Ayesha Ashraf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

After Mid-Terms

Design Pattern
Adapter design pattern
• Adapter pattern works as a bridge between two incompatible
interfaces. This type of design pattern comes under structural pattern
as this pattern combines the capability of two independent interfaces.
• An Adapter Pattern says that just "converts the interface of a class
into another interface that a client wants".
• In other words, to provide the interface according to client
requirement while using the services of a class with a different
interface.
• The Adapter Pattern is also known as Wrapper.
Components
• We have 4 components:
• Target: Domain-specific interface requested by the Client.
• Client: Applies business logic, and collaborates with the target.
• Adaptee: The interface which is incompatible with the target. Needs
adaptor.
• Adapter: The compatibility object between the Adaptee and the
Target.
Bridge Design Pattern
• Bridge is used when we need to decouple an abstraction from its
implementation so that the two can vary independently. This type of
design pattern comes under structural pattern as this pattern
decouples implementation class and abstract class by providing a
bridge structure between them.
• Key Components and Concepts
• The Bridge Design Pattern comprises the following key components:
• Abstraction: This class defines the high-level logic and holds a reference
to the implementation. It declares methods that are meaningful to clients.
• Refined Abstraction: A concrete subclass of Abstraction that further
customizes the abstraction's behavior.
• Implementation: This interface declares methods that are implemented
by concrete implementations. It focuses on low-level details.
• Concrete Implementation: These classes provide actual implementations
of the methods defined in the Implementation interface.

You might also like