본문 바로가기

💻 개발IT/OOP

1. Object-Oriented

Object(=Entity) 정의

  • informal : SW뿐만 아니라 일반적인 모든 사물 (physical(ex. truck...), conceptual(ex. chemical process...) or software(ex. linked list...), informally)
  • formal : 유니크한 ID가 있고 다른 것과 구별되는 boundary가 있고 내부에 attribute와 operations을(꼭 둘 다 가지고 있어야함) 가지고 있는 개체 (An object is an entity with a well-defined boundary and identity that encapsulates state and behavior)
    • state : object의 상태 (represented by attributes and relationships)
      • 시간이 지남에 따라 변할 수 있음
      • State 정보가 모두 같더라도 두 Objects는 다른 Object임 (서로 유니크한 ID를 가지므로)
    • behavior : object의 행위(represented by operations, methods, and state machines)


Object는 collaboration(message passing)이 필요하다

  • 다른 Object는 encapsulation되어있어서 attribute가 open 되어있지 않기 때문 (직접 접근 불가능)
  • 따라서 getter, setter 함수를 이용 (C와의 차이점)
    ※ sequence diagram : object 간의 collaboration을 나타냄



Class

  • object을 만드는 템플릿 (a description of a set of objects)
    ※ object는 class의 instance
  • 동일한 class를 통해 나온 object는 동일한 state, behavior을 가짐
  • Attribute
    • a named property of a class
    • 항목은 똑같지만 value값은 다를 수 있음
  • Operation
    • the implementation of a service
    • 같은 class의 object 내의 operation은 모두 같음



예제

  • + public(operation default), - private(attribute default)
  • public Professor() → constructor 
반응형

'💻 개발IT > OOP' 카테고리의 다른 글

3. Object-Oriented Development (OOD)  (0) 2022.02.04
2. Object-Oriented Principles  (0) 2022.02.03

You are seeing this message because ad or script blocking software is interfering with this page.
Disable any ad or script blocking software, then reload this page.