Object-Oriented Modeling: Dynamic Behavior - Use Cases, Sequences, and Statecharts, Study notes of Computer Science

An overview of dynamic behavior in object-oriented modeling using uml. Topics include use case diagrams, use case scenarios, interaction diagrams, sequence diagrams, and statechart diagrams. Use case diagrams describe the externally observable behavior of a system and its interactions with external entities. Sequence diagrams depict object interaction by highlighting the time ordering of method invocations. Statechart diagrams represent finite state machines and depict the flow of control using states and transitions.

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-6fi
koofers-user-6fi 🇺🇸

8 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1/14/2009
1
Object-Oriented Modeling
Using UML: Dynamic Models
CS 3331
Dynamic Behavior
What happens when the program runs
How do states of objects change
How do objects interact with each other
How is data transformed
Use case diagram
Describes the externally observable
behavior of system functions, usually to
define system requirements
Describes interactions between the
system and external entities
Example: Goldmine
Check
Grades
Register
actor
system
boundary
use case
Validate User
<<include>>
Student
Elements of Use Case Diagram
Actor:
Use case:
Relationship:
Example: Goldmine (Cont.)
<<include>>
User
Student
Faculty Enter Grades
Validate User
Check Grades
Get Roster
Register
<<include>>
<<extend>>
User
Student Faculty
pf3
pf4
pf5

Partial preview of the text

Download Object-Oriented Modeling: Dynamic Behavior - Use Cases, Sequences, and Statecharts and more Study notes Computer Science in PDF only on Docsity!

Object-Oriented Modeling

Using UML: Dynamic Models

CS 3331

Dynamic Behavior

• What happens when the program runs

• How do states of objects change

• How do objects interact with each other

• How is data transformed

Use case diagram

• Describes the externally observable

behavior of system functions, usually to

define system requirements

• Describes interactions between the

system and external entities

Example: Goldmine

Check

Grades

Register

actor

system

boundary

use case

Validate User

<>

Student

Elements of Use Case Diagram

• Actor:

• Use case:

• Relationship:

Example: Goldmine (Cont.)

<>

User

Student

Faculty

Enter Grades

Validate User

Check Grades

Get Roster

Register

<>

<>

User

Student Faculty

Use Case Scenarios

Use Case: Check Grades

Description : View the grades of a specific year and semester

Actors : Student

Precondition : The student is already registered

Main scenario:

User System

  1. The user enters the year and

semester, e.g., Fall 2006.

  1. The system carries out “Validate User”.
  2. The system prompts for the year and semester.
  3. The system displays the grades of the courses

taken in the given year and semester.

Alternative :

The student enters “All” for the year and semester, and the system displays

grades of all courses taken so far.

Exceptional:

The “Validate User” use case fails; the system repeats the validation use case.

Interaction Diagrams

• 4 types

– Sequence Diagrams

– Communication Diagrams

– Interaction Overview Diagram

– Timing Diagram

Sequence diagram

• Depicts object interaction by highlighting

the time ordering of method invocations

• Describes a sequence of method calls

among objects

Example

: Customer : Order : Payment : Product : Supplier

place an order

process

validate

deliver

if ( payment ok )

back order

if ( not in stock )

get address

mail to address

message

lifetime

control

object

sdPlaceOrder

Example (Cont.)

: Customer : Order : Payment : Product : Supplier

place an order

process

validate

deliver

if ( payment ok )

back order

if ( not in stock )

get address

mail to address

Sequence of message sending

Sequence Diagram

sdPlaceOrder

:CustomerWIndow :Customer

Change

Update

Transitions

• Lead from one state to another

• Instantaneous

• 4 types of events:

Statechart Diagram

• Graph representing finite state machine

• Network of states and transitions

• Good for modeling reactive systems

Elements of Statechart

Idle Running

Definition

• Event

  • An occurrence of a stimulus that can trigger a state

transition

  • Instantaneous: no duration

Simple Phone Example

dial digit(n)

[incomplete]

Dialing Connecting

busy

connected

dial digit(n)

[valid] / connect dial digit(n)

[invalid]

Invalid

Ringing

Busy

Another Example

anomaly

Normal

Recovery

Identification

Pressure

Recovery

Temperature

Recovery

recovery success

recovery success

recovery

success

anomaly=

temperature

anomaly=

pressure

recovery failure

recovery

failure

recovery

failure

Composite States

anomaly

Normal

Recovery

Identification

Pressure

Recovery

Temperature

Recovery

recovery

success

done

done

temperature pressure

Recovery

recovery

failure

Composite States (Cont.)

• Used to simplify diagrams

• Inside, looks like statechart

• May have composite transitions

• May have transitions from substates

• Sequential and parallel

Composites and Transitions

Idle

Maintenance

Printing

Selecting Processing

Validating

Transition from substate

Including Composite States

Start

entry / start dial tone

exit / end dial tone

Partial Dialing

entry / number.append(n)

digit(n)

digit(n)

[number.isValid()]

Dialing

Dial Number

Include / Dialing