SlideShare a Scribd company logo
1 of 29
Download to read offline
Façade
Design
Pattern
Presented by
Masoud Sadrnezhaad
October 28, 2023
Table of contents
When to apply the Façade
pattern in software design?
Classes, Instances, States,
SOLID Principles
Exploring the concept and
purpose of façade pattern.
How clients interact with the
Façade and some codes.
Visual representation of the
pattern's structural diagram
Abstract Factory, Mediator,
Singleton
01
04
02
05
03
06
Object-Oriented Introduction Diagrams
Applicability Sample Code Related Patterns
Object-Oriented
01
Classes, Instances, States, SOLID Principles
Single Responsibility Principle
Open-Closed Principle
Liskov Substitution Principle
Interface Segregation Principle
Dependency Inversion Principle
Introduction
02
Exploring the concept and purpose of
façade pattern.
Design Patterns
Design Patterns
● Best practices for software development
recurring design problems
● Includes problem descriptions, solutions, and
application guidelines.
● Provide implementation hints and examples.
● Illustrate class and object relationships.
Goal of Design Patterns
● Understand the problem and matching it with
some pattern
● Making the present design reusable for the
future usage
● Speed up development with proven
approaches.
As the name façade suggests, it means
"the face of the building."
Façade Pattern
Analogy
● A glass face of a building hides its complexities from passersby.
● Similarly, the facade design pattern conceals system complexities.
● The facade pattern uses a single class with simplified methods for client interaction.
● It delegates calls to existing system class methods.
● When placing a phone order, the operator serves as a facade.
● The operator offers a simple voice interface to shop services, payment, and delivery.
● Bank sample
Pronunciation is /fəˈsɑːd/
A part of Gang of Four
design patterns (23 others).
It comes under the
“Structural” category.
Diagrams
03
Visual representation of the pattern's
structural diagram.
Structural Diagram 1
Structural Diagram 2
Applicability
04
When to apply the Façade pattern in
software design?
● Facade pattern simplifies access to complex
subsystems.
● Subsystems tend to become more complex over
time, leading to smaller classes.
● Facade pattern enhances subsystem reusability
and customization but can complicate things for
non-customizing clients.
● Facades provide a default view for most clients,
allowing customization for those who need it.
● Facades separate subsystems from clients and
other subsystems, promoting independence and
portability.
● Use facades as entry points for subsystems to
simplify interactions between dependent
subsystems.
Applicability
● Facade simplifies client-subsystem interactions.
● Promotes loose coupling between subsystem
and clients, allowing changes without impacting
clients.
● Helps manage complex dependencies and
circular relationships in a system.
● Reduces compilation dependencies in large
software systems, saving time when making
changes.
● Eases porting to other platforms by minimizing
dependencies.
● Doesn't prevent direct use of subsystem classes
when needed, providing flexibility for clients.
Consequences
Sample Code
05
How clients interact with the Façade and
some codes.
Sample Code
from __future__ import annotations
class Facade:
"""
The Facade class provides a simple interface to the complex logic of one or
several subsystems. The Facade delegates the client requests to the
appropriate objects within the subsystem. The Facade is also responsible for
managing their lifecycle. All of this shields the client from the undesired
complexity of the subsystem.
"""
def __init__(self, subsystem1: Subsystem1, subsystem2: Subsystem2) -> None:
"""
Depending on your application's needs, you can provide the Facade with
existing subsystem objects or force the Facade to create them on its
own.
"""
self._subsystem1 = subsystem1 or Subsystem1()
self._subsystem2 = subsystem2 or Subsystem2()
Sample Code (Contd)
class Facade:
def operation(self) -> str:
"""
The Facade's methods are convenient shortcuts to the sophisticated
functionality of the subsystems. However, clients get only to a fraction
of a subsystem's capabilities.
"""
results = []
results.append("Facade initializes subsystems:" )
results.append(self._subsystem1.operation1())
results.append(self._subsystem2.operation1())
results.append("Facade orders subsystems to perform the action:" )
results.append(self._subsystem1.operation_n())
results.append(self._subsystem2.operation_z())
return "n".join(results)
Sample Code (Contd)
class Subsystem1:
"""
The Subsystem can accept requests either from the facade or client directly.
In any case, to the Subsystem, the Facade is yet another client, and it's
not a part of the Subsystem.
"""
def operation1(self) -> str:
return "Subsystem1: Ready!"
# ...
def operation_n (self) -> str:
return "Subsystem1: Go!"
Sample Code (Contd)
class Subsystem2:
"""
Some facades can work with multiple subsystems at the same time.
"""
def operation1(self) -> str:
return "Subsystem2: Get ready!"
# ...
def operation_z (self) -> str:
return "Subsystem2: Fire!"
Sample Code (Contd)
def client_code (facade: Facade) -> None:
"""
The client code works with complex subsystems through a simple interface
provided by the Facade. When a facade manages the lifecycle of the
subsystem, the client might not even know about the existence of the
subsystem. This approach lets you keep the complexity under control.
"""
print(facade.operation(), end="")
if __name__ == "__main__":
# The client code may have some of the subsystem's objects already created.
# In this case, it might be worthwhile to initialize the Facade with these
# objects instead of letting the Facade create new instances.
subsystem1 = Subsystem1()
subsystem2 = Subsystem2()
facade = Facade(subsystem1, subsystem2)
client_code(facade)
Sample Code Output
Facade initializes subsystems:
Subsystem1: Ready!
Subsystem2: Get ready!
Facade orders subsystems to perform the action:
Subsystem1: Go!
Subsystem2: Fire!
Related Patterns
06
Abstract Factory, Mediator, Singleton
Related Patterns
Abstract Factory
● Work with Facade to create subsystem objects uniformly
and independently from the subsystem.
● Abstract Factory can also replace Facade to hide
platform-specific classes.
Mediator.
● Abstracts existing class functionality, but it centralizes
communication between colleague objects, keeping
functionality out of them
● colleagues communicate with the mediator, not directly with
each other, while in Facade, it simplifies subsystem object
interfaces but doesn't introduce new functionality.
Singleton
● T
ypically, only one Facade object is needed, often
implemented as a Singleton.
Resources
● Gamma, E., Helm, R., Johnson, R., Vlissides, J. and Patterns, D., 1995.
Elements of Reusable Object-Oriented Software. Design Patterns.
● https://refactoring.guru/design-patterns
● https://medium.com/backticks-tildes/the-s-o-l-i-d-principles-in-pic
tures-b34ce2f1e898
Thanks :)
Do you have any questions?
masoud@hbc.ir
smm.sadrn.com

More Related Content

Similar to Facade Design Pattern

Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design patternchetankane
 
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISESoftware Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISEsreeja_rajesh
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patternssukumarraju6
 
UNIT3 PART2.pptx dhfdifhdsfvgudf dhfbdhbffdvf
UNIT3 PART2.pptx dhfdifhdsfvgudf dhfbdhbffdvfUNIT3 PART2.pptx dhfdifhdsfvgudf dhfbdhbffdvf
UNIT3 PART2.pptx dhfdifhdsfvgudf dhfbdhbffdvfputtipavan23022023
 
Gof design pattern
Gof design patternGof design pattern
Gof design patternnaveen kumar
 
Android ppt with example of budget manager
Android ppt with example of budget managerAndroid ppt with example of budget manager
Android ppt with example of budget managerNalini Mehta
 
Tech challenges in a large scale agile project
Tech challenges in a large scale agile projectTech challenges in a large scale agile project
Tech challenges in a large scale agile projectHarald Soevik
 
Crafted Design - GeeCON 2014
Crafted Design - GeeCON 2014Crafted Design - GeeCON 2014
Crafted Design - GeeCON 2014Sandro Mancuso
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignMuhammad Ali
 
Design pattern - Facade Pattern
Design pattern - Facade PatternDesign pattern - Facade Pattern
Design pattern - Facade PatternMudasir Qazi
 
A summary of software architecture guide
A summary of software architecture guideA summary of software architecture guide
A summary of software architecture guideTriet Ho
 

Similar to Facade Design Pattern (20)

Ch09
Ch09Ch09
Ch09
 
Ch09
Ch09Ch09
Ch09
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design pattern
 
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISESoftware Architecture and Project Management module III : PATTERN OF ENTERPRISE
Software Architecture and Project Management module III : PATTERN OF ENTERPRISE
 
Clean Architecture
Clean ArchitectureClean Architecture
Clean Architecture
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patterns
 
Design engineering
Design engineeringDesign engineering
Design engineering
 
Design engineering
Design engineeringDesign engineering
Design engineering
 
UNIT3 PART2.pptx dhfdifhdsfvgudf dhfbdhbffdvf
UNIT3 PART2.pptx dhfdifhdsfvgudf dhfbdhbffdvfUNIT3 PART2.pptx dhfdifhdsfvgudf dhfbdhbffdvf
UNIT3 PART2.pptx dhfdifhdsfvgudf dhfbdhbffdvf
 
Gof design pattern
Gof design patternGof design pattern
Gof design pattern
 
Android ppt with example of budget manager
Android ppt with example of budget managerAndroid ppt with example of budget manager
Android ppt with example of budget manager
 
Tech challenges in a large scale agile project
Tech challenges in a large scale agile projectTech challenges in a large scale agile project
Tech challenges in a large scale agile project
 
Crafted Design - GeeCON 2014
Crafted Design - GeeCON 2014Crafted Design - GeeCON 2014
Crafted Design - GeeCON 2014
 
06 fse design
06 fse design06 fse design
06 fse design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
 
Design pattern - Facade Pattern
Design pattern - Facade PatternDesign pattern - Facade Pattern
Design pattern - Facade Pattern
 
Design pattern
Design patternDesign pattern
Design pattern
 
Software design
Software designSoftware design
Software design
 
A summary of software architecture guide
A summary of software architecture guideA summary of software architecture guide
A summary of software architecture guide
 

More from S. M. Masoud Sadrnezhaad

استفاده از داده‌های تجربی برای پشتیبانی از انتخاب فناوری در تصمیم‌گیری معماری...
استفاده از داده‌های تجربی برای پشتیبانی از انتخاب فناوری در تصمیم‌گیری معماری...استفاده از داده‌های تجربی برای پشتیبانی از انتخاب فناوری در تصمیم‌گیری معماری...
استفاده از داده‌های تجربی برای پشتیبانی از انتخاب فناوری در تصمیم‌گیری معماری...S. M. Masoud Sadrnezhaad
 
تاریخچه و پیشینهٔ نظری اندازه‌گیری عملکرد و معرفی اجمالی برخی مدل‌های بلوغ و ...
تاریخچه و پیشینهٔ نظری اندازه‌گیری عملکرد و معرفی اجمالی برخی مدل‌های بلوغ و ...تاریخچه و پیشینهٔ نظری اندازه‌گیری عملکرد و معرفی اجمالی برخی مدل‌های بلوغ و ...
تاریخچه و پیشینهٔ نظری اندازه‌گیری عملکرد و معرفی اجمالی برخی مدل‌های بلوغ و ...S. M. Masoud Sadrnezhaad
 
تحلیل بده‌بستان‌ها میان ویژگی‌های کیفی برای پشتیبانی از تصمیم‌های معماری نرم‌...
تحلیل بده‌بستان‌ها میان ویژگی‌های کیفی برای پشتیبانی از تصمیم‌های معماری نرم‌...تحلیل بده‌بستان‌ها میان ویژگی‌های کیفی برای پشتیبانی از تصمیم‌های معماری نرم‌...
تحلیل بده‌بستان‌ها میان ویژگی‌های کیفی برای پشتیبانی از تصمیم‌های معماری نرم‌...S. M. Masoud Sadrnezhaad
 
سامانهٔ پشتیبان تصمیم برای شناسایی معماری‌های نامزد و اتخاذ تصمیم‌های معماری ...
سامانهٔ پشتیبان تصمیم برای شناسایی معماری‌های نامزد و اتخاذ تصمیم‌های معماری ...سامانهٔ پشتیبان تصمیم برای شناسایی معماری‌های نامزد و اتخاذ تصمیم‌های معماری ...
سامانهٔ پشتیبان تصمیم برای شناسایی معماری‌های نامزد و اتخاذ تصمیم‌های معماری ...S. M. Masoud Sadrnezhaad
 
آماده‌سازی ذهن برای خلاقیت و ابزار داستان‌سرایی
آماده‌سازی ذهن برای خلاقیت و ابزار داستان‌سراییآماده‌سازی ذهن برای خلاقیت و ابزار داستان‌سرایی
آماده‌سازی ذهن برای خلاقیت و ابزار داستان‌سراییS. M. Masoud Sadrnezhaad
 
نمایش اجرای فرایندهای حرفه به کمک ابزارهای پویانمایی و شبیه‌سازی زمان و هزینه...
نمایش اجرای فرایندهای حرفه به کمک ابزارهای پویانمایی و شبیه‌سازی زمان و هزینه...نمایش اجرای فرایندهای حرفه به کمک ابزارهای پویانمایی و شبیه‌سازی زمان و هزینه...
نمایش اجرای فرایندهای حرفه به کمک ابزارهای پویانمایی و شبیه‌سازی زمان و هزینه...S. M. Masoud Sadrnezhaad
 
چارچوب توصیف منبع برای ذخیره و بازیابی معنا
چارچوب توصیف منبع برای ذخیره و بازیابی معناچارچوب توصیف منبع برای ذخیره و بازیابی معنا
چارچوب توصیف منبع برای ذخیره و بازیابی معناS. M. Masoud Sadrnezhaad
 
حوزه‌های پژوهش در زمینهٔ مهندسی نرم‌افزار سامانه‌های خودتطبیق و خودسازمانده
حوزه‌های پژوهش در زمینهٔ مهندسی نرم‌افزار سامانه‌های خودتطبیق و خودسازماندهحوزه‌های پژوهش در زمینهٔ مهندسی نرم‌افزار سامانه‌های خودتطبیق و خودسازمانده
حوزه‌های پژوهش در زمینهٔ مهندسی نرم‌افزار سامانه‌های خودتطبیق و خودسازماندهS. M. Masoud Sadrnezhaad
 
معرفی و اجرای سناریوی SWIM در چارچوب Rainbow برای شبیه‌سازی معماری نرم‌افزار ...
معرفی و اجرای سناریوی SWIM در چارچوب Rainbow برای شبیه‌سازی معماری نرم‌افزار ...معرفی و اجرای سناریوی SWIM در چارچوب Rainbow برای شبیه‌سازی معماری نرم‌افزار ...
معرفی و اجرای سناریوی SWIM در چارچوب Rainbow برای شبیه‌سازی معماری نرم‌افزار ...S. M. Masoud Sadrnezhaad
 
معرفی و آموزش نحوهٔ استفاده از نرم‌افزار ERPNext برای برنامه‌ریزی منابع سازمانی
معرفی و آموزش نحوهٔ استفاده از نرم‌افزار ERPNext برای برنامه‌ریزی منابع سازمانیمعرفی و آموزش نحوهٔ استفاده از نرم‌افزار ERPNext برای برنامه‌ریزی منابع سازمانی
معرفی و آموزش نحوهٔ استفاده از نرم‌افزار ERPNext برای برنامه‌ریزی منابع سازمانیS. M. Masoud Sadrnezhaad
 
بی‌طرفی شبکه و ریشه‌های آن
بی‌طرفی شبکه و ریشه‌های آنبی‌طرفی شبکه و ریشه‌های آن
بی‌طرفی شبکه و ریشه‌های آنS. M. Masoud Sadrnezhaad
 
از فرهنگ اجازه تا فرهنگ آزاد یا چگونه رسانه‌ها از تکنولوژی و قانون برای محدود...
از فرهنگ اجازه تا فرهنگ آزاد یا چگونه رسانه‌ها از تکنولوژی و قانون برای محدود...از فرهنگ اجازه تا فرهنگ آزاد یا چگونه رسانه‌ها از تکنولوژی و قانون برای محدود...
از فرهنگ اجازه تا فرهنگ آزاد یا چگونه رسانه‌ها از تکنولوژی و قانون برای محدود...S. M. Masoud Sadrnezhaad
 
طراحی و معماری خدمات ابری زیرساخت آمازون (AWS)
طراحی و معماری خدمات ابری زیرساخت آمازون (AWS)طراحی و معماری خدمات ابری زیرساخت آمازون (AWS)
طراحی و معماری خدمات ابری زیرساخت آمازون (AWS)S. M. Masoud Sadrnezhaad
 
معرفی و آموزش سامانهٔ مدیریت محتوا مزانین
معرفی و آموزش سامانهٔ مدیریت محتوا مزانینمعرفی و آموزش سامانهٔ مدیریت محتوا مزانین
معرفی و آموزش سامانهٔ مدیریت محتوا مزانینS. M. Masoud Sadrnezhaad
 
نقش جامعه و دولت در حمایت از نرم‌افزار آزاد
نقش جامعه و دولت در حمایت از نرم‌افزار آزادنقش جامعه و دولت در حمایت از نرم‌افزار آزاد
نقش جامعه و دولت در حمایت از نرم‌افزار آزادS. M. Masoud Sadrnezhaad
 
بزرگ‌داده؛ مقیاسی از دنیای واقعی
بزرگ‌داده؛ مقیاسی از دنیای واقعیبزرگ‌داده؛ مقیاسی از دنیای واقعی
بزرگ‌داده؛ مقیاسی از دنیای واقعیS. M. Masoud Sadrnezhaad
 

More from S. M. Masoud Sadrnezhaad (20)

Epistemic Justification
Epistemic JustificationEpistemic Justification
Epistemic Justification
 
استفاده از داده‌های تجربی برای پشتیبانی از انتخاب فناوری در تصمیم‌گیری معماری...
استفاده از داده‌های تجربی برای پشتیبانی از انتخاب فناوری در تصمیم‌گیری معماری...استفاده از داده‌های تجربی برای پشتیبانی از انتخاب فناوری در تصمیم‌گیری معماری...
استفاده از داده‌های تجربی برای پشتیبانی از انتخاب فناوری در تصمیم‌گیری معماری...
 
تاریخچه و پیشینهٔ نظری اندازه‌گیری عملکرد و معرفی اجمالی برخی مدل‌های بلوغ و ...
تاریخچه و پیشینهٔ نظری اندازه‌گیری عملکرد و معرفی اجمالی برخی مدل‌های بلوغ و ...تاریخچه و پیشینهٔ نظری اندازه‌گیری عملکرد و معرفی اجمالی برخی مدل‌های بلوغ و ...
تاریخچه و پیشینهٔ نظری اندازه‌گیری عملکرد و معرفی اجمالی برخی مدل‌های بلوغ و ...
 
تحلیل بده‌بستان‌ها میان ویژگی‌های کیفی برای پشتیبانی از تصمیم‌های معماری نرم‌...
تحلیل بده‌بستان‌ها میان ویژگی‌های کیفی برای پشتیبانی از تصمیم‌های معماری نرم‌...تحلیل بده‌بستان‌ها میان ویژگی‌های کیفی برای پشتیبانی از تصمیم‌های معماری نرم‌...
تحلیل بده‌بستان‌ها میان ویژگی‌های کیفی برای پشتیبانی از تصمیم‌های معماری نرم‌...
 
سامانهٔ پشتیبان تصمیم برای شناسایی معماری‌های نامزد و اتخاذ تصمیم‌های معماری ...
سامانهٔ پشتیبان تصمیم برای شناسایی معماری‌های نامزد و اتخاذ تصمیم‌های معماری ...سامانهٔ پشتیبان تصمیم برای شناسایی معماری‌های نامزد و اتخاذ تصمیم‌های معماری ...
سامانهٔ پشتیبان تصمیم برای شناسایی معماری‌های نامزد و اتخاذ تصمیم‌های معماری ...
 
آماده‌سازی ذهن برای خلاقیت و ابزار داستان‌سرایی
آماده‌سازی ذهن برای خلاقیت و ابزار داستان‌سراییآماده‌سازی ذهن برای خلاقیت و ابزار داستان‌سرایی
آماده‌سازی ذهن برای خلاقیت و ابزار داستان‌سرایی
 
نمایش اجرای فرایندهای حرفه به کمک ابزارهای پویانمایی و شبیه‌سازی زمان و هزینه...
نمایش اجرای فرایندهای حرفه به کمک ابزارهای پویانمایی و شبیه‌سازی زمان و هزینه...نمایش اجرای فرایندهای حرفه به کمک ابزارهای پویانمایی و شبیه‌سازی زمان و هزینه...
نمایش اجرای فرایندهای حرفه به کمک ابزارهای پویانمایی و شبیه‌سازی زمان و هزینه...
 
چارچوب توصیف منبع برای ذخیره و بازیابی معنا
چارچوب توصیف منبع برای ذخیره و بازیابی معناچارچوب توصیف منبع برای ذخیره و بازیابی معنا
چارچوب توصیف منبع برای ذخیره و بازیابی معنا
 
حوزه‌های پژوهش در زمینهٔ مهندسی نرم‌افزار سامانه‌های خودتطبیق و خودسازمانده
حوزه‌های پژوهش در زمینهٔ مهندسی نرم‌افزار سامانه‌های خودتطبیق و خودسازماندهحوزه‌های پژوهش در زمینهٔ مهندسی نرم‌افزار سامانه‌های خودتطبیق و خودسازمانده
حوزه‌های پژوهش در زمینهٔ مهندسی نرم‌افزار سامانه‌های خودتطبیق و خودسازمانده
 
معرفی و اجرای سناریوی SWIM در چارچوب Rainbow برای شبیه‌سازی معماری نرم‌افزار ...
معرفی و اجرای سناریوی SWIM در چارچوب Rainbow برای شبیه‌سازی معماری نرم‌افزار ...معرفی و اجرای سناریوی SWIM در چارچوب Rainbow برای شبیه‌سازی معماری نرم‌افزار ...
معرفی و اجرای سناریوی SWIM در چارچوب Rainbow برای شبیه‌سازی معماری نرم‌افزار ...
 
معرفی و آموزش نحوهٔ استفاده از نرم‌افزار ERPNext برای برنامه‌ریزی منابع سازمانی
معرفی و آموزش نحوهٔ استفاده از نرم‌افزار ERPNext برای برنامه‌ریزی منابع سازمانیمعرفی و آموزش نحوهٔ استفاده از نرم‌افزار ERPNext برای برنامه‌ریزی منابع سازمانی
معرفی و آموزش نحوهٔ استفاده از نرم‌افزار ERPNext برای برنامه‌ریزی منابع سازمانی
 
بی‌طرفی شبکه و ریشه‌های آن
بی‌طرفی شبکه و ریشه‌های آنبی‌طرفی شبکه و ریشه‌های آن
بی‌طرفی شبکه و ریشه‌های آن
 
Git Version Control System Part 2
 Git Version Control System Part 2 Git Version Control System Part 2
Git Version Control System Part 2
 
Classroom Object Oriented Language (COOL)
Classroom Object Oriented Language (COOL)Classroom Object Oriented Language (COOL)
Classroom Object Oriented Language (COOL)
 
از فرهنگ اجازه تا فرهنگ آزاد یا چگونه رسانه‌ها از تکنولوژی و قانون برای محدود...
از فرهنگ اجازه تا فرهنگ آزاد یا چگونه رسانه‌ها از تکنولوژی و قانون برای محدود...از فرهنگ اجازه تا فرهنگ آزاد یا چگونه رسانه‌ها از تکنولوژی و قانون برای محدود...
از فرهنگ اجازه تا فرهنگ آزاد یا چگونه رسانه‌ها از تکنولوژی و قانون برای محدود...
 
طراحی و معماری خدمات ابری زیرساخت آمازون (AWS)
طراحی و معماری خدمات ابری زیرساخت آمازون (AWS)طراحی و معماری خدمات ابری زیرساخت آمازون (AWS)
طراحی و معماری خدمات ابری زیرساخت آمازون (AWS)
 
معرفی و آموزش سامانهٔ مدیریت محتوا مزانین
معرفی و آموزش سامانهٔ مدیریت محتوا مزانینمعرفی و آموزش سامانهٔ مدیریت محتوا مزانین
معرفی و آموزش سامانهٔ مدیریت محتوا مزانین
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
نقش جامعه و دولت در حمایت از نرم‌افزار آزاد
نقش جامعه و دولت در حمایت از نرم‌افزار آزادنقش جامعه و دولت در حمایت از نرم‌افزار آزاد
نقش جامعه و دولت در حمایت از نرم‌افزار آزاد
 
بزرگ‌داده؛ مقیاسی از دنیای واقعی
بزرگ‌داده؛ مقیاسی از دنیای واقعیبزرگ‌داده؛ مقیاسی از دنیای واقعی
بزرگ‌داده؛ مقیاسی از دنیای واقعی
 

Recently uploaded

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 

Recently uploaded (20)

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 

Facade Design Pattern

  • 2. Table of contents When to apply the Façade pattern in software design? Classes, Instances, States, SOLID Principles Exploring the concept and purpose of façade pattern. How clients interact with the Façade and some codes. Visual representation of the pattern's structural diagram Abstract Factory, Mediator, Singleton 01 04 02 05 03 06 Object-Oriented Introduction Diagrams Applicability Sample Code Related Patterns
  • 9. Introduction 02 Exploring the concept and purpose of façade pattern.
  • 10. Design Patterns Design Patterns ● Best practices for software development recurring design problems ● Includes problem descriptions, solutions, and application guidelines. ● Provide implementation hints and examples. ● Illustrate class and object relationships. Goal of Design Patterns ● Understand the problem and matching it with some pattern ● Making the present design reusable for the future usage ● Speed up development with proven approaches.
  • 11. As the name façade suggests, it means "the face of the building."
  • 12. Façade Pattern Analogy ● A glass face of a building hides its complexities from passersby. ● Similarly, the facade design pattern conceals system complexities. ● The facade pattern uses a single class with simplified methods for client interaction. ● It delegates calls to existing system class methods. ● When placing a phone order, the operator serves as a facade. ● The operator offers a simple voice interface to shop services, payment, and delivery. ● Bank sample Pronunciation is /fəˈsɑːd/ A part of Gang of Four design patterns (23 others). It comes under the “Structural” category.
  • 13. Diagrams 03 Visual representation of the pattern's structural diagram.
  • 16. Applicability 04 When to apply the Façade pattern in software design?
  • 17. ● Facade pattern simplifies access to complex subsystems. ● Subsystems tend to become more complex over time, leading to smaller classes. ● Facade pattern enhances subsystem reusability and customization but can complicate things for non-customizing clients. ● Facades provide a default view for most clients, allowing customization for those who need it. ● Facades separate subsystems from clients and other subsystems, promoting independence and portability. ● Use facades as entry points for subsystems to simplify interactions between dependent subsystems. Applicability
  • 18. ● Facade simplifies client-subsystem interactions. ● Promotes loose coupling between subsystem and clients, allowing changes without impacting clients. ● Helps manage complex dependencies and circular relationships in a system. ● Reduces compilation dependencies in large software systems, saving time when making changes. ● Eases porting to other platforms by minimizing dependencies. ● Doesn't prevent direct use of subsystem classes when needed, providing flexibility for clients. Consequences
  • 19. Sample Code 05 How clients interact with the Façade and some codes.
  • 20. Sample Code from __future__ import annotations class Facade: """ The Facade class provides a simple interface to the complex logic of one or several subsystems. The Facade delegates the client requests to the appropriate objects within the subsystem. The Facade is also responsible for managing their lifecycle. All of this shields the client from the undesired complexity of the subsystem. """ def __init__(self, subsystem1: Subsystem1, subsystem2: Subsystem2) -> None: """ Depending on your application's needs, you can provide the Facade with existing subsystem objects or force the Facade to create them on its own. """ self._subsystem1 = subsystem1 or Subsystem1() self._subsystem2 = subsystem2 or Subsystem2()
  • 21. Sample Code (Contd) class Facade: def operation(self) -> str: """ The Facade's methods are convenient shortcuts to the sophisticated functionality of the subsystems. However, clients get only to a fraction of a subsystem's capabilities. """ results = [] results.append("Facade initializes subsystems:" ) results.append(self._subsystem1.operation1()) results.append(self._subsystem2.operation1()) results.append("Facade orders subsystems to perform the action:" ) results.append(self._subsystem1.operation_n()) results.append(self._subsystem2.operation_z()) return "n".join(results)
  • 22. Sample Code (Contd) class Subsystem1: """ The Subsystem can accept requests either from the facade or client directly. In any case, to the Subsystem, the Facade is yet another client, and it's not a part of the Subsystem. """ def operation1(self) -> str: return "Subsystem1: Ready!" # ... def operation_n (self) -> str: return "Subsystem1: Go!"
  • 23. Sample Code (Contd) class Subsystem2: """ Some facades can work with multiple subsystems at the same time. """ def operation1(self) -> str: return "Subsystem2: Get ready!" # ... def operation_z (self) -> str: return "Subsystem2: Fire!"
  • 24. Sample Code (Contd) def client_code (facade: Facade) -> None: """ The client code works with complex subsystems through a simple interface provided by the Facade. When a facade manages the lifecycle of the subsystem, the client might not even know about the existence of the subsystem. This approach lets you keep the complexity under control. """ print(facade.operation(), end="") if __name__ == "__main__": # The client code may have some of the subsystem's objects already created. # In this case, it might be worthwhile to initialize the Facade with these # objects instead of letting the Facade create new instances. subsystem1 = Subsystem1() subsystem2 = Subsystem2() facade = Facade(subsystem1, subsystem2) client_code(facade)
  • 25. Sample Code Output Facade initializes subsystems: Subsystem1: Ready! Subsystem2: Get ready! Facade orders subsystems to perform the action: Subsystem1: Go! Subsystem2: Fire!
  • 27. Related Patterns Abstract Factory ● Work with Facade to create subsystem objects uniformly and independently from the subsystem. ● Abstract Factory can also replace Facade to hide platform-specific classes. Mediator. ● Abstracts existing class functionality, but it centralizes communication between colleague objects, keeping functionality out of them ● colleagues communicate with the mediator, not directly with each other, while in Facade, it simplifies subsystem object interfaces but doesn't introduce new functionality. Singleton ● T ypically, only one Facade object is needed, often implemented as a Singleton.
  • 28. Resources ● Gamma, E., Helm, R., Johnson, R., Vlissides, J. and Patterns, D., 1995. Elements of Reusable Object-Oriented Software. Design Patterns. ● https://refactoring.guru/design-patterns ● https://medium.com/backticks-tildes/the-s-o-l-i-d-principles-in-pic tures-b34ce2f1e898
  • 29. Thanks :) Do you have any questions? masoud@hbc.ir smm.sadrn.com