Facade Pattern
-system의 복잡함을 감추고 client에 interface를 제공.
ShapeMaker.java ( facade class )
public class ShapeMaker { Circle circle; Rectangle rectangle; Square square; public ShapeMaker(){ circle = new Circle(); rectangle =new Rectangle(); square = new Square(); } public void drawCircle(){ circle.draw(); } public void drawRectangle(){ rectangle.draw(); } public void drawSqaure(){ square.draw(); } }
결과 :
07-20 13:48:21.208 11008 11008 D Shape : Circle draw
07-20 13:48:21.208 11008 11008 D Shape : Rectangle draw
07-20 13:48:21.208 11008 11008 D Shape : Square draw
출처 :
https://www.tutorialspoint.com/design_pattern/facade_pattern.htm
'pattern' 카테고리의 다른 글
Proxy Pattern (0) | 2018.07.20 |
---|---|
Flyweight pattern (0) | 2018.07.20 |
Decorator pattern (0) | 2018.07.20 |
uml 기호 정리 (0) | 2018.07.20 |
Composite pattern (0) | 2018.07.19 |