Question

In: Computer Science

What are the pattern elements for the Facade Design Pattern?

What are the pattern elements for the Facade Design Pattern?

Solutions

Expert Solution

Pattern elements for a Facade design pattern are listed below :-

  • Intent : Facade is a structural design pattern that wraps a complicated subsystem with a simpler interface. It basically adds an interface to existing system to hide its complexities.   
  • Motivation : A common goal is to minimize the communication and dependencies between subsystems. To achieve this goal we can introduce a facade that provides a single, simplified interface to the facilities of a subsystem.   
  • Problem & Solution : Please refer to the below attached image for better understanding.

​​​​​​

  • Applicability : We should use facade subsystem as an entry point to each subsystem level for clients and other subsystems. If subsystems are dependent, then we can simplify the dependencies between them by making them communicate with each other through their facades.
  • Facade structure : Please refer to the below attached image for Facade structure.
  • Participants : 1) Facade - it has all the information about the responsible subsystem classes for a client's request and appoints them to appropriate subsystem objects. 2) Subsystem classes - they implement their functionality and also handle the work assigned by the facade object.
  • Collaborations : Clients communicate with the subsystem by a single unified interface(Facade). And Facade forwards the requests to respective subsystems objects.
  • Consequences : 1) Facade reduces the number of objects that clients deal with by providing a unified interface and make the usage of Subsystem very easy for the client. 2) Facade doesn't prevent applications from using subsystem classes if they need to. So we can choose between ease of use and generality.
  • Implementation : We are creating a MobileShope interface and concrete classes implementing the MobileShope interface. A facade class ShopeKeeperFacade is defined in the next step. ShopekeeperFacade class uses the concrete classes to pass user calls to these classes FacadeClient, our client class will use ShopekeeperFacade class to show the results. Please refer to the image below :
  • Related Patterns : 1) Abstract factory pattern :- We can use this with facade to provide an interface for developing subsystem objects in a subsystem independent way. 2) Mediator :- it is similar to facade, it abstracts functionality of existing classes. It's main function is to abstract arbitrary communication between colleague objects.

Related Solutions

What are some various psychological design elements that come with Instagram and how do these elements...
What are some various psychological design elements that come with Instagram and how do these elements influence our behaviors online?
If you were to design an air conditioning unit for your home, what electronics design elements...
If you were to design an air conditioning unit for your home, what electronics design elements would you incorporate (gates, input signals, output signals, feedback signals, etc). Be as detailed as possible.
If you were to design an air conditioning unit for your home, what electronics design elements...
If you were to design an air conditioning unit for your home, what electronics design elements would you incorporate (gates, input signals, output signals, feedback signals, etc.). Be as detailed as possible. If you were an IC chip designer, what would be the steps to take to minimize the amount of gates used. Why is that important? In one paragraph, why do you think learning about this branch of electronics, that is, digital electronics, is important? Problem 1. For following...
Can you give a java code example of using a singleton pattern and factory pattern design...
Can you give a java code example of using a singleton pattern and factory pattern design together?
What will the generic confounding pattern be for a 2^5-2 (resolution III) experiment design?
What will the generic confounding pattern be for a 2^5-2 (resolution III) experiment design?
What technology, equipment, and design elements would be use to support the sustainability of a birthing...
What technology, equipment, and design elements would be use to support the sustainability of a birthing center in the future.
The brand, packaging and design are elements of product policy. Explain why these elements have a...
The brand, packaging and design are elements of product policy. Explain why these elements have a paramount importance for the commercial success of a product basing on the specificities of each of it?
What are some physical security design elements for alarm/access control systems servers?
What are some physical security design elements for alarm/access control systems servers?Why is Physical Security design elements for alarm/access control systems/servers so crucial in a data center?
1) A. What are research methods and the important elements of research design (i.e. describe population...
1) A. What are research methods and the important elements of research design (i.e. describe population vs sample, indicators/measures, counter factual, time of measurement and analysis). B. What are internal validity, external validity and reliability and how do they relate to the concept of research methods? C. Compare and contrast three of the following types of research designs: Single subject, true experimental group design, quasi experimental group design, non-experimental design. Answer each part of the question.
or each of the design patterns listed below, briefly discuss the purpose of that pattern and...
or each of the design patterns listed below, briefly discuss the purpose of that pattern and explain how its use contributed to the code you developed for your Maze Game in Assignment 2. Your explanation should provide specific examples from your game that illustrate the function performed by the implementation of each pattern. a)      Command Pattern b)      State Pattern c)      Singleton Pattern
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT