外观模式
来源:互联网 发布:python 去水印 编辑:程序博客网 时间:2024/05/30 13:42
class SubSystemOne{
public void MethodOne(){
System.out.println("子系统方法一");
}
}
class SubSystemTwo{
public void MethodTwo(){
System.out.println("子系统方法二");
}
}
class SubSystemThree{public void MethodThree(){System.out.println("子系统方法三");}}外观类:class Facade{SubSystemOne one;SubSystemTwo two;SubSystemThree three;SubSystemFour four;public Facade(){one=new SubSystemOne();two=new SubSystemTwo();Three=new SubSystemThree();four=new SubSystemFour();}public void MethodA(){System.out.println("方法A");one.MethodOne();two.MethodTwo();three.MethodThree();}public void MethodB(){System.out.println("方法B");two.MethodTwo();}}客户端调用static void main(String[] args){Facade facade=new Facade();facade.MethodA();facade.MethodB();}首先,在设计之初,应该有意识的将不同的两个层分离,比如经典的三层架构,就需要考虑在数据访问层和业务逻辑层...,层与层之间建立外观Facade其次,在开发解读,子系统往往因为不断的重构演化而变的相当复杂,增加外观Facade可以提供一个简单的接口,减少它们之间的依赖
第三,在维护一个遗留的大型系统,可能已经非常难以维护和扩展了。
外观模式什么时候用:
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- 外观模式
- java中 == 与 equal 的区别
- Js正则基础篇 test match exec
- pgsql 数据库恢复备份
- JSP和Servlet编码的作用及原理
- 经典SQL案例
- 外观模式
- 校友网---需求分析
- 归并树 第K大值
- eclipse生成jar包
- 校友网--系统架构分析与设计
- 读取grib格式的小工具,在linux中的安装
- 持久层的EAO颗粒封装
- http_equiv属性
- spring注入出现 Error creating bean with name