A Student Guide to ObjectOriented Development - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

A Student Guide to ObjectOriented Development

Description:

Increasingly used to model ways a system can respond to external events ... entry / start dialling tone. exit / stop dialling tone. do / emit dialling tone ... – PowerPoint PPT presentation

Number of Views:10
Avg rating:3.0/5.0
Slides: 12
Provided by: jacqui5
Category:

less

Transcript and Presenter's Notes

Title: A Student Guide to ObjectOriented Development


1
A Student Guide to Object-Oriented Development
  • Chapter 7 State Diagrams

2
State diagram
A state diagram shows the effects of all use
cases on one class
3
State diagram
  • Increasingly used to model ways a system can
    respond to external events
  • All objects of the class (the individual
    customers or products) have the same set of
    responses, but each responds differently
    depending on the state it is in.

4
State Diagram
  • Describes the behaviour of a single class
    illustrating how its objects behave during their
    lifetimes ( all uses cases )
  • Model the order that events affect an object
  • The bike must be assigned a number before it can
    be rented
  • In most systems only a few of the classes are
    complicated enough to merit a state diagram.
  • State diagrams are also referred to as state
    charts and state transition diagrams

5
States and Events
  • State - The situation an object it is in while
    satisfying some condition (such as a bank account
    having some money) or waiting for an event (such
    as someone trying to withdraw or deposit money).
  • State has duration.
  • Event - An event is something that happens which
    has significance for the system and affects an
    object of at least one of the systems classes.
  • We can tell if an object is in a particular state
    by looking at the values of some of its
    attributes and its links to other objects.
  • Events are instantaneous.

6
The state of an object
  • For example, if a Bank Account object is in
    credit the value of the balance attribute will be
    a positive amount or zero
  • but if it is overdrawn the value of balance will
    be negative.
  • In the Wheels case study, we can tell if a bike
    is rented out because there will be a link from
    the Bike object to an active Hire object.

7
state
start state
stop state
transition from one state to another
self-transition (no change of state)
event guard / action
transition label (each of the three parts is
optional)
8
State diagram for a bank account class
stop state
Self transition
Guard
state diagram for a bank account class
Event fires a transition
Start state
9
Event/guard/action
superstate
10
State diagrams key words
  • after used to show an event taking place
    after a specified time period e.g. after 6
    months / delete
  • when event takes place when a condition is
    satisfied e.g. when all items in stock / fill
    order

11
State diagrams entry and exit events
offHook entry / start dialling tone exit / stop
dialling tone do / emit dialling tone
Keyword do behaviour that lasts for the
duration of a state is called an activity, it is
modelled using the keyword do
Write a Comment
User Comments (0)
About PowerShow.com