본문 바로가기

Patterns

02. 객체지향 설계 원칙

객체와 관계를 이용한 실세계 매핑

관계 유형

Aggregation / Composition

Inheritance / Realization

Dependency

 

 

 

 

 

상황(Context)에 따라 관계 유형이 달라짐

 

 

LSP (Liskov Substution Principle)  (WIKIPEDIA : Liskov substitution principle)

-. 기존 타입의 하위 타입을 만드는 가이드

-. Substitutabllity (대체 가능성)

"if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e., objects of type S may be substituted for objects of type T) without altering any of the desirable properties of that program (correctness, task performed, etc.)"

-. Barbara Liskov

"What is wanted here is something like the following substitution property: If for each object o1 of type S there is an object 02 of type T such that for all programs P defined in terms of T, the behavior of P is unchanged when o1 is substituted for o2 then S is a subtype of T."

S타입의 객체 o1에 대해 T타입의 객체 o2가 있을 경우, T로 정의된 모든 프로그램 P에 대해, o1이 o2로 대체되어도 P가 변경되지 않는다면 S가 T의 하위타입니다.

-. 프로그램 모듈이 Base클래스에 대한 참조를 사용하고 있다면, 프로그램 모듈의 기능에 영향을 주지 않고 Base 클래스를 파생클래스로 대체할 수 있다.

 

WIKIPEDIA : Liskov substitution principle

 

 

아직 남아있다.