外观设计模式(Facade pattern)
描述: 外观设计模式就是隐藏系统的复杂性,向客户端提供一个客户端可以访问系统的接口,这种类型的设计模式属于结构型模式,它向现有的系统添加一个接口,来隐藏系统的复杂度
核心思想: 封装系统的复杂度,对外提供简单的接口
使用场景: 
- 为复杂的模块或者子系统提供外界访问的接口
 
- 子系统相对的独立
 
外观设计模式的优点:
外观设计模式的缺点: 
- 不符合开闭原则,如果要改东西很麻烦,继承重写都不合适。
 
示例:
1 2 3
   | public interface Shape {    void draw(); }
  | 
 
1 2 3 4 5 6 7
   | public class Rectangle implements Shape {      @Override    public void draw() {       System.out.println("Rectangle::draw()");    } }
  | 
 
1 2 3 4 5 6 7
   | public class Square implements Shape {      @Override    public void draw() {       System.out.println("Square::draw()");    } }
  | 
 
1 2 3 4 5 6 7
   | public class Circle implements Shape {      @Override    public void draw() {       System.out.println("Circle::draw()");    } }
  | 
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
   | public class ShapeMaker {    private Shape circle;    private Shape rectangle;    private Shape square;      public ShapeMaker() {       circle = new Circle();       rectangle = new Rectangle();       square = new Square();    }      public void drawCircle(){       circle.draw();    }    public void drawRectangle(){       rectangle.draw();    }    public void drawSquare(){       square.draw();    } }
  | 
 
1 2 3 4 5 6 7 8 9
   | public class FacadePatternDemo {    public static void main(String[] args) {       ShapeMaker shapeMaker = new ShapeMaker();         shapeMaker.drawCircle();       shapeMaker.drawRectangle();       shapeMaker.drawSquare();          } }
  | 
 
享元设计模式