外观模式(Facade)是运用比较多的一种设计模式,简单而言就是将多个子系统的能力封装后对外暴露,即将子系统的功能组合成一个复杂功能。如下图:

设计模式(外观模式)

  • SystemFacade
public class SystemFacade {
    private OneSystem one;
    private TwoSystem two;
    
    public SystemFacade(){
        one = new OneSystem();
        two = new TwoSystem();
    }
    
    public void doJob(){
        one.doJob();
        two.doJob();
    }    
}

相关文章:

  • 2021-07-28
  • 2021-05-05
  • 2022-01-08
猜你喜欢
  • 2022-12-23
  • 2021-12-30
  • 2021-05-05
  • 2021-08-20
相关资源
相似解决方案