Facade Pattern
Presentation by Vishal
Content
1. Introduction
2. Gang of Four Definition
3. Problem
4. Intent and solution
5. Participants and collaborators
6. Consequences
7. Implementation Example
8. Additional notes
9. Bibliography
Introduction
Types of Design Patterns:
Structural - are about organizing different classes/objects to form larger structures
and provide new functionality. Other eg: Adapter, Bridge
Behavioural - are about identifying common communication patterns between objects and
realize these patterns. Eg: Strategy, Iterator
Creational - about class instantiation or object creation. Eg: Factory
GoF Definition
Provide a unified interface to a set of interfaces in a subsystem.
Uses existing interfaces/classes.
Facade defines a higher-level interface that makes the subsystem easier to use.
Problem
You need to use only a subset of a complex
system.
Or you need to interact with the system in a
particular way.
Client Classes
Sub-system
Classes
Intent and Solution
The Facade presents a new interface for
the client of the existing system to use.
Structuring a system into subsystems
helps reduce complexity.
Participants and collaborators
Facade
● Knows the functions performed by the subsystems.
● Delegates client requests to these subsystems according to their need.
Subsystem
● Implements the functionality.
● Handle the work assigned by the facade.
Consequences
Shields clients from the subsystem, making easier to use functionality.
Promotes weak coupling between the subsystem and its clients.
Helps eliminate circular dependency.
However, since the Facade is not complete, certain functionality may be unavailable to the
client.
Implementational Example
Additional notes
The Facade can also be used to hide, or encapsulate, the system.
The Facade could contain the system as private members of the Facade class.
In this case, the original system would be linked in with the Facade class, but not presented to
users of the Facade class.
Bibliography
Alan Shalloway, James R Trot, “Design Patterns Explained – A New Perspective on Object-
Oriented Design”, Pearson, 2nd Edition, 4th Impression 2010.
https://www.slideshare.net/jainikpatel12/facade-pattern-47994970
https://www.geeksforgeeks.org/design-patterns-set-1-introduction/

Facade pattern presentation(.pptx)

  • 1.
  • 2.
    Content 1. Introduction 2. Gangof Four Definition 3. Problem 4. Intent and solution 5. Participants and collaborators 6. Consequences 7. Implementation Example 8. Additional notes 9. Bibliography
  • 3.
    Introduction Types of DesignPatterns: Structural - are about organizing different classes/objects to form larger structures and provide new functionality. Other eg: Adapter, Bridge Behavioural - are about identifying common communication patterns between objects and realize these patterns. Eg: Strategy, Iterator Creational - about class instantiation or object creation. Eg: Factory
  • 4.
    GoF Definition Provide aunified interface to a set of interfaces in a subsystem. Uses existing interfaces/classes. Facade defines a higher-level interface that makes the subsystem easier to use.
  • 5.
    Problem You need touse only a subset of a complex system. Or you need to interact with the system in a particular way. Client Classes Sub-system Classes
  • 6.
    Intent and Solution TheFacade presents a new interface for the client of the existing system to use. Structuring a system into subsystems helps reduce complexity.
  • 7.
    Participants and collaborators Facade ●Knows the functions performed by the subsystems. ● Delegates client requests to these subsystems according to their need. Subsystem ● Implements the functionality. ● Handle the work assigned by the facade.
  • 8.
    Consequences Shields clients fromthe subsystem, making easier to use functionality. Promotes weak coupling between the subsystem and its clients. Helps eliminate circular dependency. However, since the Facade is not complete, certain functionality may be unavailable to the client.
  • 9.
  • 10.
    Additional notes The Facadecan also be used to hide, or encapsulate, the system. The Facade could contain the system as private members of the Facade class. In this case, the original system would be linked in with the Facade class, but not presented to users of the Facade class.
  • 11.
    Bibliography Alan Shalloway, JamesR Trot, “Design Patterns Explained – A New Perspective on Object- Oriented Design”, Pearson, 2nd Edition, 4th Impression 2010. https://www.slideshare.net/jainikpatel12/facade-pattern-47994970 https://www.geeksforgeeks.org/design-patterns-set-1-introduction/