Design: Facade Pattern Design
Design a software component that acts as a facade to multiple complex subsystems, simplifying client interaction. Out of scope: detailed implementation of subsystems.
Functional Requirements
Non-Functional Requirements
Client | v Facade / | \ Subsystem1 Subsystem2 Subsystem3
Facade pattern in system design?class SubsystemA {
void operationA() { print('A'); }
}
class SubsystemB {
void operationB() { print('B'); }
}
class Facade {
SubsystemA a = SubsystemA();
SubsystemB b = SubsystemB();
void doWork() {
a.operationA();
b.operationB();
}
}
void main() {
Facade f = Facade();
f.doWork();
}class Subsystem {
void action() { print('Action'); }
}
class Facade {
Subsystem subsystem;
void doTask() {
subsystem.action();
}
}
void main() {
Facade f = Facade();
f.doTask();
}turnOnAll() and setTemperature() to control all devices correctly describes creating a Facade class with simple methods controlling multiple devices. Options A, B, and D misunderstand Facade's purpose.Pass the test and this pattern moves unknown