카샤의 만개시기

Adapter 패턴과 Decorator 패턴의 차이 본문

Foundation/Design Pattern

Adapter 패턴과 Decorator 패턴의 차이

SKaSha 2019. 10. 27. 10:41

Decorator 패턴은 인터페이스를 바꾸지 않고 책임(기능)만 추가하는 것이다.
Adapter 패턴은 인터페이스를 변경해서 클라이언트에서 필요로 하는 인터페이스로 적응시키기 위한 용도로써 호환성을 위해 사용된다.

결론

decorator 패턴은 기존의 객체를 장식하는데 사용하고 adapter 패턴은 새로운 인터페이스를 추가하는 용도

링크

Decorator 패턴 : https://skasha.tistory.com/65
Adapter 패턴 : https://skasha.tistory.com/66

'Foundation > Design Pattern' 카테고리의 다른 글

Command Pattern  (0) 2019.11.02
Decorator 패턴  (0) 2019.10.27
Adapter 패턴  (0) 2019.10.27
Facade Pattern  (0) 2019.10.19
Comments