0% found this document useful (0 votes)
13 views

Chapter 3 (Behavioral Diagrams) - Part 1 Intro, State Transition

The document discusses state transition diagrams. It provides examples to illustrate: 1) States are conditions an object exists in during its lifetime, changing when events occur. Events trigger activities that cause state transitions. 2) A state transition diagram identifies the primary object, its states, and the events and activities that cause state changes. It depicts the initial, intermediate, and final states and transitions between states. 3) The document gives an example of a passenger traveling by bus to show waiting, traveling and arrival states changing due to bus arrival and boarding/alighting activities. 4) It also provides an example state transition diagram for a library book management system, showing catalogued, borrowed, returned, and
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Chapter 3 (Behavioral Diagrams) - Part 1 Intro, State Transition

The document discusses state transition diagrams. It provides examples to illustrate: 1) States are conditions an object exists in during its lifetime, changing when events occur. Events trigger activities that cause state transitions. 2) A state transition diagram identifies the primary object, its states, and the events and activities that cause state changes. It depicts the initial, intermediate, and final states and transitions between states. 3) The document gives an example of a passenger traveling by bus to show waiting, traveling and arrival states changing due to bus arrival and boarding/alighting activities. 4) It also provides an example state transition diagram for a library book management system, showing catalogued, borrowed, returned, and
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

STATE

TRANSITION
DIAGRAMS
Introduction
• Behavioral diagrams depict the behavioral features of a system.
 Difference with structural diagrams: depict the static/skeleton view of a system, behaviours – what an element is
doing at a particular time, who is making that element to do what it’s doing, and how the action of that element
impacts the whole system
• They are used to show dynamic aspects of a system such as time aspects and human participants and external events

• It encompasses the following diagrams:


 State transition/State chart diagram
 Use case diagram
 Activity diagram
 Robustness diagram
1. State Transition/State Chart Diagram
• It is used to show the time-dependent aspects of a system.
• It shows how an object changes from one state as caused by certain triggers, events or activities happening.
• A state is a condition in which an object exists at a certain point in its lifetime, and it changes when a certain
event/trigger occurs.
• The most important purpose of State chart/transition diagram is to model lifetime of an object from creation to
termination.

Rules of Drawing a State Transition/State Chart diagram:


• Identify the primary object, the states, the events and activities
 The primary object is the primary physical/abstract thing that certain events are happening to, or is doing some
set of progressive things e.g. a passenger is waiting for a bus, bus arrives, he boards the bus, travels then alights
at destination – passenger is the primary object whose activities are changing based on certain occurrences,
called events/triggers
 State – a condition the object is because something has happened to it or it has done something. E.g. When a
passenger is waiting for bus, he’s in waiting state, when bus arrives and he boards, he’s now at travelling state,
when the bus gets to destination and he alights, he’s now at arrived state
 These states are dependent on certain events/triggers and activities. For instance, for passenger to transition
from waiting to travelling state:
 Bus has to arrive – Bus arrival, is the event/trigger. It triggers an activity
 Passenger has to board the bus – boarding is the activity. When this activity happens, then passenger is no longer
in waiting state, but in travelling state. It is the activity that causes the transition from state to state, to happen.
1. State Transition/State Chart Diagram…
Continued
• The initial state is represented with a full filled circle,
as shown below and the name of the state. • The events/triggers and activities must be indicated.
They can be written against the transition arrow or
the arrow can be given a letter, number or symbol,
and the event/trigger and activity/ies associated with
that transition arrow written later on a Key.
• The intermediary state/s are shown by
a soft-edged rectangle and must be Travelling E/T: Bus arriving
named, as shown >>> a.
A: Boarding bus

• The final state is shown using a full filled circle


inside a plain circle, as shown below. i.
b.

Key:
i. Event/Trigger: Bus arriving
• The transition from state to Activity: Boarding bus
state is shown using an arrow
Example:
A passenger who wants to travel waits at a pick up station. When the needed
bus arrives, he/she boards the bus. When bus reaches destination, the
passenger alights. Represent this scenario using a state transition/chart
diagrams

a b
- Identify the primary object: Travelling
Passenger waiting Arrival/destination

- Identify the states


Key
Waiting, Travelling, Destination A: B:
Events/Triggers Events/Triggers
- Bus arrive at pick up station - Bus reach destination
Activities: Activities:
- Board bus - Alight
Question
Zetech University uses a library management system to manage library books. New books
have first to be catalogued before issuance can happen. A student/staff can borrow book,
then return it on the agreed date. To successfully borrow a book, the student/staff must give
their ID, and librarian enters book details, student details, and issues the book. When the
book is borrowed, the system tracks the book, and if it passes due date, it is placed under
defaulters where the student/staff can pay an agreed amount. For a book to be successfully
returned, the student/staff has to surrender book to librarian and librarian checks the book
from the borrowed items.
Represent the system using a state transition diagram

Primary object:
- Book
States:
- Catalogued, borrowed, returned, defaulted
a b
Borrowed Returned
catalogued
c
d

Defaulted

Key
A: B: C: D:
Events/Triggers Events/Triggers Events/Triggers Events/Triggers
- Surrender ID - Surrender book - Book passes due date - Surrender book
Activities: Activities: Activities: - Pay
- Librarian inputs student and - Librarian checks from - Places book under Activities:
book details borrowed items defaulters - Librarian checks from
- Receive ID defaulted items
- Receive ID

You might also like