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

COM423_5-Modeling the Behavioural View

The document discusses behavioral modeling in object-oriented analysis and design, highlighting the importance of functional, structural, and behavioral models. It details the creation and notation of sequence diagrams and communication diagrams, emphasizing their roles in illustrating object interactions and dynamic aspects of systems. Additionally, it covers behavioral state machines, explaining how they represent an object's states and transitions in response to events.

Uploaded by

Cassim Jaffer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

COM423_5-Modeling the Behavioural View

The document discusses behavioral modeling in object-oriented analysis and design, highlighting the importance of functional, structural, and behavioral models. It details the creation and notation of sequence diagrams and communication diagrams, emphasizing their roles in illustrating object interactions and dynamic aspects of systems. Additionally, it covers behavioral state machines, explaining how they represent an object's states and transitions in response to events.

Uploaded by

Cassim Jaffer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

COM323 – Object-Oriented

Analysis and Design


Behavioural modelling
Introduction
● Functional models describe the functional or external
behavioral view of an information system.
● Structural models depict the internal structural or static
view of the information system.
● Behavioral models represent the internal behavior or
dynamic view of an information system.
● Two types of behavioral models, those that represent
the
○ Underlying details of a business process portrayed by a
use-case model (interaction diagrams)
○ Changes that occur in the underlying data (behavioral state
machines)
Behavioural models
● Behavioral models show how the underlying objects in a
problem domain will work together to form a collaboration
to support each of the use cases.
○ Shown by the interaction between the objects that
collaborate to support a use case using interaction (sequence
and communication) diagrams. OR
○ Shown by the effect that the set of use cases has on the
objects in the system (behavioral state machines).
● Creating behavioral models is an iterative process
○ Iterating over the individual behavioral models, the functional
and structural models making the necessary changes along
the way
● While a class diagram focuses at the class level, an
interaction diagram focuses on the object level.
Sequence Diagram
● The static view (Class and Object diagrams) represents
how the objects are defined and arranged into a structure.
○ It does not tell you how the objects behave
● In contrast, the dynamic view represents the interactions
of the objects in a system.
○ Models how the objects work together to represent:
■ how the system will respond to actions from the users
■ how data is moved from storage to a user view
■ how it maintains internal integrity

● Can be
○ Generic- showing all possible scenarios for a use case, or
○ instance - depicting a single scenario within the use case.
Sequence Diagram…
● Everything in an object-oriented system is accomplished
by objects
● Objects:
○ manage data
○ move data around in the system
○ respond to queries
○ protect the system
● Objects work together by communicating or interacting
with one another
○ As such all interactions can be mapped to objects
Sequence Diagram: Example
● Step 1 & 2: Bill Creates an
Order
● Step 3: Bill adds items to
the order
● Step 4 & 5: Item checked
for availability
● Step 6 & 7: If item is
available it is added to the
order
● Step 8: End of transaction
Creating a Sequence Diagram
● Requires completed Use Case model and the Class
diagram.
● Generate sets of interactions and candidate objects for the
interactions to be modelled
● Sequence diagrams are modeled at the object level not
class level:
○ Allows for scenarios that use more than one instance of the
same class
○ Allows working at the level of facts and test data
Sequence Diagram Notation
● The Sequence diagram uses three fundamental notation
elements: objects, messages, and object lifeline
● The objects use the same notation as in the Object
diagram
○ participating objects lined up across the top of the diagram
● The object lifeline is a vertical dashed line below each
object
● A message or stimulus is usually a call, a signal, or a
response.
○ A message is represented by an arrow
○ An object can send a message to itself (self-delegation)
Sequence Diagram Extended Notation
● Sequence diagrams can be enhanced to illustrate object
activation and object termination
● Timed events: some messages are timed and if response is
not obtained within the expected time the message is
timed out
○ Represented by a circle on the arrow line and the stereotype
<<timeout>>
● Asynchronous events: messages that do not require a
response
○ Represented by a stick arrowhead instead of the solid
arrowhead

Sequence Diagram Extended Notation:
example
● 1: Object Activation
● 2: Object Deactivation
● 3: Timed Event
● 4: Asynchronous Event
● 5: Object Termination
Exercise: Develop a
sequence diagram
● Set the context
○ System, Use Case or Use Case
Scenario level?
● Identify actors and objects
● Set life line for each object
● Add messages
○ Review flow of events in narrative,
activity diagrams and CRC Card role
playing
● Place execution occurrence
● Validate
● Replicate for all possible scenarios
Exercise: Develop a sequence diagram
● Set the context
○ System, Use Case or
Use Case Scenario
level?
● Identify actors and
objects
● Set life line for each
object
● Add messages
○ Review flow of events
in narrative, activity
diagrams and CRC Card
role playing
● Place execution
occurrence
● Validate
● Replicate for all
possible scenarios
Solution: What’s wrong here?

Kondwani G. Munthali (PhD) 4/25/2023


Department of Computer
Communication diagram
● Like sequence diagrams, they provide a view of the
dynamic aspects of an object-oriented system
● Show message-passing relationships instead of
aggregation or generalization associations
○ Ie object diagram without aggregation or
generalization associations
● Emphasize the flow of messages through a set of
objects
○ SD focus on the time ordering of the messages being
passed
Creating a Communication diagram
● Set the context
○ System, Use Case or Use Case Scenario level?
● Identify actors, objects and associations
● Lay out diagram
○ Minimise crossings
● Add messages
● Validate

15
Develop a Communication diagram

Set the
context
System,
Use Case
or Use
Case
Scenario
level?
Identify
actors,
objects and
associations
Lay out
diagram
Minimise
crossings
Add
messages
Validate
Behavioural State Machines
● A behavioral state machine is a dynamic model that shows the
different states through which a single object passes during its
life in response to events, along with its responses and actions.
○ not used for all objects
● It shows the different states of the object and what events cause
the object to change from one state to another
○ Eg New, current and former student
● Used to help understand the dynamic aspects of a single class
and how its instances evolve over time
○ As opposed to use case or use-case scenario orientation for
interaction diagrams
Behavioural State Machines…
● State of an object is defined by the value of its attributes and its
relationships with other objects at a particular point in time
○ Eg new, current or former student;
● An event is something that takes place at a certain point in time and
changes a value or values that describe an object, which, in turn,
changes the object’s state.
● A transition is a relationship that represents the movement of an
object from one state to another state
○ Can have a guard condition.
● An action is an atomic, non decomposable process that cannot be
interrupted
○ Assumed to take zero time, and they are associated with a transition.
● An activity is a nonatomic, decomposable process that can be
interrupted.
○ take long to complete and can be started and stopped by an action.
● State vs subclass!
○ Is a “Finale” state for or subclass of Student?
Behavioural State Machines… exercise
● Create a corresponding Bahavioural State Machine diagram from the
following narrative:
We track current customer status to help avoid uncollectible receivables
and identify customers worthy of preferred treatment. All customers are
initially set up as prospects, but when they place their first order, they are
upgraded to active.
If a customer doesn’t pay an invoice on time, he is placed on probation. If he
does pay on time and has ordered more than $10,000 in the previous six
months, he warrants preferred status.
Preferred status may be changed only if the customer is late on two or
more payments. Then he returns to active status rather than probation,
giving him the benefit of the doubt based on his preferred history.
Behavioural State Machines… solution

20
References
● Chapter 6 – Dennis et al (2015). Systems Analysis and
Design: An Object-oriented Approach with UML. John Wiley
& Sons

You might also like