디자인패턴
-
Strategy프로그래밍/디자인패턴 2012. 11. 19. 10:38
Strategy Motivation There are common situations when classes differ only in their behavior. For this cases is a good idea to isolate the algorithms in separate classes in order to have the ability to select different algorithms at runtime. Intent Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that us..
-
디자인 패턴 - Adapter 패턴프로그래밍/프로그래밍 관련 2012. 4. 17. 09:47
Adapter(적응자) Adapter?— Adapter는 개조시키다 라는 의미로 직류 10볼트의 컴퓨터를 교류 100볼트로 환경에 맞게 바꿔서 사용가능하게 하는것을 말한다.— 프로그래밍에서의 Adapter은 이미 제공되는 인터페이스를 다른 클래스에서도 재사용할수 있도록 바꿔주는 디자인패턴이다.Adapter 의 의도— 클래스의 인터페이스를 사용자가 기대하는 인터페 이스 형태로 적응(변환)— 함께 동작시킴— 다른이름 : 래퍼(Wrapper) 어떠한 장치가 있을 때 다른 장치에 도움을 받아야 할 때 그 장치간에 호환성이 있어야 한다.인터페이스를 우리가 사용할 수 있는 인터페이스를 바꿔주는 장치가 아답터 이다.주된 개체가 사용할 수 있는 인터페이스에 맞게끔 다른 클래스를 이용해서 주된 개체가 사용할 수 있는 인..