11 Software Engineering Dr. K. T. Tsang Lecture 9 Advance State Modeling kentsang/SWE/SWE.htm.

Post on 02-Jan-2016

215 views 2 download

Tags:

Transcript of 11 Software Engineering Dr. K. T. Tsang Lecture 9 Advance State Modeling kentsang/SWE/SWE.htm.

11

Software EngineeringDr. K. T. Tsang

Lecture 9

Advance State Modelinghttp://www.uic.edu.hk/~kentsang/SWE/SWE.htm

2

Sub-state diagram & submachine

• Complex state diagram can be simplified by using a high-level diagram with sub-diagrams expanding certain states.

• A submachine is a state diagram that may be invoked as part of another state diagram.

• The UML notation for a submachine is a state name followed by a colon and the submachine name.

3

Example: submachine

Fig.6.2 p.111 B&R

4

Example: submachine -2

Fig.6.3 p.112 B&R

5

Nested states• States with common features and shared

behaviors can be grouped together to form a macro-state. This will help to simplify the original complex state diagram.

• The constituent states of the macro-state is called nested states.

6

State diagrams for a phone line

Fig.5.8 p.97

(no nested states)

7

Fig.6.4 p.113

State diagrams for a phone line

(with nested states)

8

Signal (class) generalization

• Signals can be organized into a hierarchy in inheritance relationship.

Hierarchy for keyboard signals -- Fig. 6.6 p.115

9

Hierarchy for keyboard signals -- Fig. 6.6 p.115

10

Concurrency

• In general, objects are autonomous entities that can act & change state independently.

• Sometimes, they need not be completely independent and may subject to shared constraints that cause some correspondence among their state changes.

11

Aggregation concurrencyExample: Car – fig.6.7 p.116

• State diagram for aggregate object is a collection for its parts.

• The aggregate state comprises of (“and” related) one state from each part.

• Transition in one part may depend on the states in other parts.

In the car example, the transition of ignition from “off” to “starting” depends on the transmission in “neutral” state.

12

Example: Car – fig.6.7 p.116

13

Concurrent activities within an object

• Some object may have to perform 2 or more activities concurrently.

• These activities may not be synchronized but they must be completed before the object can progress to its next state.

Fig. 6.9 p.117 CashDispenser example

14

Fig. 6.9 p.117 CashDispenser example

15

Summary – OO modeling methodologies

• Class model (static view of classes)

– Classes & Associations – Class diagram, Object diagram

• State model (dynamic view of a class, life of objects)

– States, events, signals, activities, & transitions– State diagram

• Interaction model (dynamic view across classes)

– Sequence diagram (time)– Collaboration diagram (players)– Activity diagram (processes)

16

Development stages

• Requirement

• Analysis

• Design – System (architecture)– Class

• Implementation

• Testing

• Deployment, maintenance

OO Methodologies

17

Reading for this lecture

• Chapter 6 Blaha & Rumbaugh