Q1. What is the Law of Demeter and how is it related to the Factory pattern?
A: The Law of Demeter is a design guideline that talks about the following:
The principle of least knowledge and Law of Demeter are the same and both point to the philosophy of loose coupling. The principle of least knowledge fits the use case of the Façade pattern as the name is intuitive and the word principle acts as a guideline, not being strict, and being useful only when needed.
Q2. Can there be multiple Façades for a subsystem?
A: Yes, one could implement more than one façade for a group of subsystem components.
Q3. What are the disadvantages of the principle of least knowledge?
A: A Façade provides a simplified interface for the clients to interact with subsystems. In the spirit of providing a simplified interface, an application can have multiple unnecessary interfaces that add to the complexity of the system and reduce runtime performance.
Q4. Can the client access the subsystems independently?
A: Yes, in fact, the Façade pattern provides simplified interfaces so that the client need not be bothered about the complexity of the subsystems.
Q5. Does the Façade add any functionality of its own?
A: A Façade can add its "thinking" to the subsystems, such as making sure that the order of innovation for subsystems can be decided by the Façade.
3.145.27.58