Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
61 views

Assignment Sda: Name: - Muhammad Aqib Sap Id: - 2381 Assignment Topic: - Difference Between Façade and Adapter Pattern

The document compares the Facade and Adapter patterns. The Facade pattern provides a simpler interface to more complex underlying systems, while the Adapter pattern allows classes with incompatible interfaces to work together by translating requests. An example of a Facade is a control panel, while an example of an Adapter is a power adapter.

Uploaded by

Aqib Sherazi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Assignment Sda: Name: - Muhammad Aqib Sap Id: - 2381 Assignment Topic: - Difference Between Façade and Adapter Pattern

The document compares the Facade and Adapter patterns. The Facade pattern provides a simpler interface to more complex underlying systems, while the Adapter pattern allows classes with incompatible interfaces to work together by translating requests. An example of a Facade is a control panel, while an example of an Adapter is a power adapter.

Uploaded by

Aqib Sherazi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

ASSIGNMENT SDA

Name: - Muhammad Aqib Sap Id: - 2381


Assignment Topic: -
Difference Between Façade and Adapter Pattern:
Façade Pattern Adapter Pattern
The Facade pattern is used when a simpler The Adapter design pattern is meant to
interface is wanted (and again, could be 'translate' the interface of one or more
implemented the same way by wrapping the classes into an interface that the client
offending classes.) expects to use.
Wouldn’t say you're using a facade when Adapter would translate the calls to the
the existing interface is incompatible, just expected interface into the actual interface
when you need to make it more readable, the wrapped classes use.
less poorly-designed, etc.
Facade defines a new interface Whereas Adapter uses an old interface
Simplifies multiple complex components Provides different interface for an interface
with single interface

Works with multiple components Works with single component

Control panel is an example A power adapter is an example

High-level interface Low-level interface

The purpose of a facade is simplicity The purpose of a adapter is interoperability

A facade is used to encapsulate an entire An adapter is used, where you have two
layer, and offer some methods to access it components that should already work
"conveniently" together, but don't, only because of some
"unimportant" differences in the interface.
Facade pattern can be applied at any point It makes things work after they're designed
of development

Façade Pattern Class Diagram: -


Adapter Pattern Class Diagram: -

You might also like