外观模式
字数: 0

基本概念

Facade Pattern: Provide a unified interface to a set of interfaces in a subsystem. It defines a higher-level interface that makes the subsystem easier to use.
notion image
notion image
Note: It do not restrict us to directly connect with subsystems.

实现代码

子系统

外观

测试类

Q & A

What are key advantages of using a facade pattern?
  • Instead of presenting complex subsystems, it presents one simplified interface to clients.
  • This approach also promotes weak coupling by separating a client from the subsystems.
What are the challenges associated with a facade pattern?
  • Subsystems are connected with the facade layer. So, you need to take care of an additional layer of coding.
    • 🤔 感觉很多不同的模式都可以套用这个
  • When the internal structure of a subsystem changes, you need to incorporate the changes in the facade layer also.
 
2023 - 2026