Shanghai Jiao Tong University 上海交通大学 Object Oriented Analysis and Design Other UML Diagrams 上海交通大学软件工程中心
Shanghai Jiao Tong University 上海交通大学软件工程中心 Object Oriented Analysis and Design Other UML Diagrams
Outline Statechart diagrams ◆Deployment diagrams Component diagrams Object Oriented Analysis and Design 2
Object Oriented Analysis and Design 2 Outline Statechart diagrams Deployment diagrams Component diagrams
Review:An Object Has State The state of an object is one of the possible conditions in which an object may exist. The state of an object normally changes over time. ☐Name:J Clark 口Employee ID:567138 HireDate:07/25/1991 Status:Tenured Discipline:Finance MaxLoad:3 Name:J Clark Employee ID:567138 Date Hired:July 25,1991 Status:Tenured Discipline:Finance Professor Clark Maximum Course Load:3 classes Object Oriented Analysis and Design 3
Object Oriented Analysis and Design 3 Review: An Object Has State The state of an object is one of the possible conditions in which an object may exist. The state of an object normally changes over time. Name: J Clark Employee ID: 567138 Date Hired: July 25, 1991 Status: Tenured Discipline: Finance Maximum Course Load: 3 classes Name: J Clark Employee ID: 567138 HireDate: 07/25/1991 Status: Tenured Discipline: Finance MaxLoad: 3 Professor Clark
What Are Statechart Diagrams? A statechart diagram shows a state machine. It specifies the sequence of states that an object can be in: The events and conditions that cause the object to reach those states The actions that take place when those states are reached Sample Sample State 1 State 2 Object Oriented Analysis and Design
Object Oriented Analysis and Design 4 What Are Statechart Diagrams? A statechart diagram shows a state machine. It specifies the sequence of states that an object can be in: ▪ The events and conditions that cause the object to reach those states ▪ The actions that take place when those states are reached Sample State 1 Sample State 2
Drawing States A state is represented as a rounded rectangle on a statechart diagram. As a comparison,note the subtle difference between a state and an activity Sample Sample State 1 Activity Object Oriented Analysis and Design 5
Object Oriented Analysis and Design 5 Drawing States A state is represented as a rounded rectangle on a statechart diagram. As a comparison, note the subtle difference between a state and an activity. Sample State 1 Sample Activity
Special States The initial state is the state entered when an object is created. An initial state is mandatory. Only one initial state is permitted. The initial state is represented as a solid circle. A final state indicates the end of life for an object. A final state is optional. A final state is indicated by a bull's eye. More than one final state may exist. Sample Sample State 1 State 2 Object Oriented Analysis and Design 6
Object Oriented Analysis and Design 6 Special States The initial state is the state entered when an object is created. ▪ An initial state is mandatory. ▪ Only one initial state is permitted. ▪ The initial state is represented as a solid circle. A final state indicates the end of life for an object. ▪ A final state is optional. ▪ A final state is indicated by a bull’s eye. ▪ More than one final state may exist. Sample State 1 Sample State 2
What Are Events? An event is the specification of a significant occurrence that has a location in time and space. An event is an occurrence of a stimulus that can trigger a state transition. Example: Adding a student to a course ·Creating a new course Event State A State B Object Oriented Analysis and Design 7
Object Oriented Analysis and Design 7 What Are Events? An event is the specification of a significant occurrence that has a location in time and space. ▪ An event is an occurrence of a stimulus that can trigger a state transition. ▪ Example: • Adding a student to a course • Creating a new course State A State B Event
What Are Transitions? ◆ A transition is a change from an originating state to a successor state as a result of some stimulus. The successor state could possibly be the originating state. Atransition may take place in response to an event. Transitions can be labeled with events Event State A State B Transition Object Oriented Analysis and Design 8
Object Oriented Analysis and Design 8 What Are Transitions? A transition is a change from an originating state to a successor state as a result of some stimulus. ▪ The successor state could possibly be the originating state. A transition may take place in response to an event. Transitions can be labeled with events. State A State B Event Transition
Example:Statechart Applied 【accepted] Enrolled 【rejected] First year credits>=28】 Second year ∠fcredits>=56】 Third year Hiatus leave ∠Tcredits>=84】 Fourth year retur H credits>=112] Graduated Object Oriented Analysis and Design 9
Object Oriented Analysis and Design 9 Example: Statechart Enrolled Freshman Sophmore Junior Senior H First year Second year Third year Fourth year Graduated [ credits >= 112 ] Applied [ rejected ] [ accepted ] H [ credits >= 28 ] [ credits >= 56 ] [ credits >= 84 ] Hiatus return leave
Outline ◆Statechart diagrams Deployment diagrams Component diagrams Object Oriented Analysis and Design 10
Object Oriented Analysis and Design 10 Outline Statechart diagrams Deployment diagrams Component diagrams