티스토리 뷰
※ tutorialspoint의 OOAD 요약 (https://www.tutorialspoints.com/object_oriented_analysis_design/)
시스템의 time-dependent 관점. 시스템 내의 object의 state change와 관련. 주요 개념은,
- state: object lifetime의 특정 조건에서의 situation
- transition: state change
- event: transition을 발생시킴
- action: event에 의해 발생하는 도중에 중단되지 않은 computation
- concurrency of transitions
state machine은 object의 behavior를 모델링. state machine은 state transition diagram으로 표현.
1. States and State Transitions
State
object의 attribute value에 대한 abstraction. object lifetime 상에서만 벌어지는 situation. state transition diagram에서는 round rectangle로 표현.
Parts of a state
- name: string은 state간에 서로를 구분하는 역할. state는 name이 없을 수 있다.
- entry/exit actions: state에 도착, sate로부터 떠나는 action
- internal transitions: state 변경이 일어나지 않는 state 내부의 변화
- sub-states: state의 하위 state
Initial and Final States
initial state는 object의 시작 상태. final state는 object의 완료 상태. 두 state는 pseudo state이며, name 외에 regular state 부분은 없을 수 있다. initial state는 filled black circle로 표현. final state는 unfilled black circle로 둘러쌓인 filled black circle로 표현.
Transition
object의 state change. object가 특정 state이고 event가 발생한 경우, object는 특정 activity를 수행하고, state change가 이뤄지게 된다. 이 때, state transition이라고 불린다. transition은 state간의 solid directed arc로 표현.
- source state: transition에 의해 영향을 받는 state
- event trigger: guard condition을 만족할 때 source state에서 transition이 발생하도록 하는 현상
- guard condition: true인 경우, event trigger를 받았을 때 transition을 발생시키는 boolean expression
- action: event에 의해 source object에서 발생하는 도중 중단이 없는 computation
- target state: transition이 완료된 후의 state
Example
person이 X에서 Y로 이동하기 위해 택시를 이용한다고 가정. person의 state로는, Waiting, Riding, Reached가 가능.

2. Events
state transition을 시작하도록 하는 현상. location in time/space를 갖지만, period를 포함하진 않는다. 일반적으로 action과 관련. (쉬운 예로, 마우스 클릭, 키 누름, 인터럽트, stack overflow 등) arc of transtion 옆에 적는 것으로 표현.
Example
위 그림에서, taxi를 타게 되면, Waiting에서 Riding으로의 transition 발생. Reached state는 person이 도착지에 도달하면 발생. 이와 가은 2가지 현상을 event Get_Taxi, Reach_Destination으로 쓸 수 있다.

External and Internal Events
external event란, 시스템의 사용자로부터 시스템 내의 object로 전달한 것. (예: 마우스 클릭)
internal event란, 시스템 내의 object가 다른 object로 전달한 것. (예: stack overflow)
Deferred Events
current state에서 object가 즉시 처리하지 않고, queue에 정렬시킴으로써, 나중에 other state의 object에 의해 처리될 이벤트
Event Classes
공통의 structure, behavior를 갖는 event group. object class와 유사하게, hierarchical structure로 구성 가능
예: 항공사의 비행 출발 event를 Flight_Departs (Flight_No, From_City, To_City, Route) 와 같은 class로 그룹화 가능
3. Actions
Activity
일정 period를 필요로 하는 state별 operation. interrupt 가능한 시스템 내의 execution. activity diagram으로 표현.
Action
특정 event의 결과로서 execution되는 operation. atomic. (= un-interruptible) action의 집합이 activity를 구성.
Entry and Exit Actions
entry action은 state에 도착 시 실행되는 action.
exit action은 state로부터 떠날 때 실행되는 action.
Scenario
특정 순서의 action들. 이것을 겪는 object behavior를 표현.
4. Diagrams for Dynamic Modeling
Interaction Diagrams
object간의 dynamic behavior 기술. object, object간의 관계, object가 주고받는 message로 구성. 즉, 관계 있는 object 그룹의 behavior를 모델링.
- sequence diagram: table 형식의 메시지 순서로 표현
- collaboration diagram: vertex, arc로 object간의 송수신 메시지를 구조적으로 표현
State Transition Diagram
single object의 dynamic behaviro 표현. object의 lifetime 동안의 state transition, transition을 발생시키는 event, condition 및 event에 대한 반응 등을 표현.
5. Concurrency of Events
System Concurrency
시스템 레벨의 동시성. 전체 시스템은 다른 것들과 동시에 실행되는 각 state machine의 집합.
Concurrency within an Object
object는 만들어내는 concurrent event. object는 sub-state들로 구성된 state를 보유, 각 sub-state에서 concurrent event 발생 가능.
Simple and Composite States
simple state: sub-structure 없음.
composite state: 내부에 nested simpler state가 있는 state. sequential sub-state / concurrent sub-state.
sub-state: 다른 state 내부에 존재. state machine의 복잡도를 낮추기 위함.
Sequential Sub-states
execution control은 sequence 순서에 따라 하나의 sub-state에서 다른 sub-state로 전달. state machine에서, 최소 1개의 initial state, final state 존재.

Concurrent Sub-states
concurrent sub-states는 병렬 실행. (state machine 내에서 동시 실행) 각각의 state machine은 개별 initial / final state 보유. 1개의 sub-state가 final state에 먼저 도착하면, control은 final state에서 waiting 한다. 모든 nested state machine이 final state가 되었을 때 sub-state들은 single flow로 결합.
