0% found this document useful (0 votes)
5 views42 pages

ITOOA3 - Slide Deck Week 5

The document covers the principles of Object-Oriented Systems Analysis and Design (SAD), focusing on sequence and state diagrams as behavioral models. It outlines guidelines for creating these diagrams, the processes involved, and the relationship between behavioral and structural models. Additionally, it includes exercises and examples to illustrate the application of these concepts in real-world scenarios.

Uploaded by

Nicole
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)
5 views42 pages

ITOOA3 - Slide Deck Week 5

The document covers the principles of Object-Oriented Systems Analysis and Design (SAD), focusing on sequence and state diagrams as behavioral models. It outlines guidelines for creating these diagrams, the processes involved, and the relationship between behavioral and structural models. Additionally, it includes exercises and examples to illustrate the application of these concepts in real-world scenarios.

Uploaded by

Nicole
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/ 42

Object Oriented SAD

ITOOA3
Disclaimer

Please note that the content made available on myLMS may deviate
slightly from what is covered in lecturer-led sessions. However, the
material on myLMS, along with prescribed textbooks and any other
designated learning resources, constitutes the compulsory content
students are expected to consult and prepare for assessments.
• Understand the rules and style guidelines for sequence diagrams,
• Understand the processes used to create sequence diagrams.
• Be able to create sequence.
• Understand the relationship between the behavioural models and
the structural and functional models.
What will be covered in the rest of today’s session?

What will be covered in the lecture-led session:

• Objects, Operations, and Message


• Sequence diagram
• Sequence diagram syntax
• Drawing the sequence diagram
Behavioural Models
• Behavioural models to represent the internal behaviour or dynamic
view of an information system.
There are two types of behavioural models:
1. Sequence diagrams – model the distribution of the behaviour of the
system over the actors and objects in the system. In this way, we
can easily see how actors and objects collaborate to provide the
functionality defined in a use case.
2. Behavioural state machines – represent the changes that occur in
the underlying data.
Behavioural Models
• Traditionally, behavioural models have been used primarily during
design, where analysts refine the behavioural models to include
implementation details. For now, our focus is on what the dynamic
view of the evolving system is and not on how the dynamic aspect of
the system will be implemented.
• Finally, we describe CRUDE analysis and the process to verify and
validate the behavioural models.
Interaction Diagrams
• One of the primary differences between class diagrams and interaction
diagrams, besides the obvious difference that one describes structure
and the other behaviour, is that the modelling focus on a class diagram is
at the class level, whereas the interaction diagrams focus on the object
level.
Objects, Operations, and Messages
• An object is an instantiation of a class, i.e., an actual person, place, or thing
about which we want to capture information. If we were building an
appointment system for a doctor’s office, classes might include doctor,
patient, and appointment.
• Each object has attributes that describe information about the object, such
as a patient’s name, birth date, address, and phone number.
• Each object also has behaviours. the behaviours are described by operations.
An operation is nothing more than an action that an object can perform. For
example, an appointment object can probably schedule a new appointment,
delete an appointment, and locate the next available appointment. Later on,
during the development of the evolving system, the behaviours will be
implemented as methods.
• Each object also can send and receive messages. Messages are
information sent to objects to tell an object to execute one of its
behaviours. Essentially, a message is a function or procedure call from one
object to another object. For example, if a patient is new to the doctor’s
office, the system sends an insert message to the application. The patient
object receives the instruction (the message) and does what it needs to do
to insert the new patient into the system (the behaviour).
Sequence Diagrams
• Sequence diagrams illustrate the objects that participate in a use case and the
messages that pass between them over time for one use case.
• A sequence diagram is a dynamic model that shows the explicit sequence of
messages that are passed between objects in a defined interaction. Because
sequence diagrams emphasize the time-based ordering of the activity that takes
place among a set of objects, they are very helpful for understanding real-time
specifications and complex use cases.
• The sequence diagram can be a generic sequence diagram that shows all possible
scenarios for a use case, but usually each analyst develops a set of instance sequence
diagrams, each of which depicts a single scenario within the use case. If you are
interested in understanding the flow of control of a scenario by time, you should use
a sequence diagram to depict this information.
Elements of a Sequence Diagram
Guidelines for Creating Sequence Diagrams
Ambler provides a set of guidelines when drawing sequence diagrams:
• Try to have the messages not only in a top-to-bottom order but also, when possible, in
a left -to-right order. To accomplish this, order the actors and objects along the top
of the diagram in the order that they participate in the scenario of the use case.
• If an actor and an object conceptually represent the same idea, one inside of the
software and the other outside, label them with the same name.
• The initiator of the scenario—actor or object—should be drawn as the farthest left
item in the diagram.
• When there are multiple objects of the same type, be sure to include a name for the
object in addition to the class of the object.
• Show return values only when they are not obvious.
• Justify message names and return values near the arrowhead of the message and
return arrows, respectively. This makes it much easier to interpret the messages and
their return values.
Creating Sequence Diagrams
A six-step process used to create a sequence
diagram:
1. Set Context
2. Identify Actors and Objects
3. Set Lifeline
4. Add Messages
5. Place Execution Occurrence
6. Validate
Campus Housing Example
Library Example
Case
Study Create a sequence diagram that depicts the following scenario:
E-commerce guest house booking system registration process:

Create a sequence diagram to display how the process of creating


a new account on a guest house booking website would be done.
The business process would be that a potential customer would
access the website, click a create register button, create an
account, and then be directed back with a welcome message of
some sort.
Exercise
Study the scenario and draw a sequence diagram for a vehicle owner that would
like to renew their vehicle registration.
An organization has been entrusted with developing a Registration and Title system
that maintains information about all vehicles registered in a particular
province. For each vehicle that is registered with the office, the system must store
the name, address, telephone number of the owner, the start date and end date of
the registration, plate information, sticker and registration fee. In addition, the
following information is maintained about the vehicles themselves: the number,
year, make, model, body, gross weight, number of passengers, colour and
kilometers. The system issues registration notices to owners of vehicles whose
registrations are due to expire after two months. When the owner renews the
registration, the system updates the registration information on the vehicle.

Adjusted from Source: Valacich, J.S., George, J.F. & Hoffer, J.A. 2015. Essentials of systems analysis and
design. 6th ed. Pearson: London. p 413.
• Understand the rules and style guidelines for state machine
diagrams,
• Understand the processes used to create state machine diagrams.
• Be able to create state machine diagrams.
• Understand the relationship between the behavioural models and
the structural and functional models.
What will be covered in the rest of today’s session?

What will be covered in the lecture-led session:

• States, Events, Transitions, Actions, and Activities


• State diagram
• State diagram syntax
• Drawing the state diagram
Behavioural State Machines
• Some of the classes in the class diagrams represent a set of objects that are quite
dynamic in that they pass through a variety of states over the course of their
existence. For example, a patient can change over time from being new to
current to former based on his or her status with the doctor’s office. A
behavioural 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.
• Typically, behavioural state machines are not used for all objects; rather,
behavioural state machines are used with complex objects to further define them
and to help simplify the design of algorithms for their methods. The behavioural
state machine shows the different states of the object and what events cause the
object to change from one state to another. Behavioural state machines should
be used to help understand the dynamic aspects of a single class and how its
instances evolve over time.
States, Events, Transitions, Actions, and Activities
• The state of an object is defined by the value of its attributes and its relationships
with other objects at a particular point in time. For example, a patient might have
a state of new, current, or former.
• 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.
It can be a designated condition becoming true, the receipt of the call for a
method by an object, or the passage of a designated period of time. The state of
the object determines exactly what the response will be.
• A transition is a relationship that represents the movement of an object from one
state to another state. Some transitions have a guard condition. A guard
condition is a Boolean expression that includes attribute values, which allows a
transition to occur only if the condition is true. An object typically moves from
one state to another based on the outcome of an action triggered by an event.
Elements of a Behavioural State Machine
Guidelines for Creating Behavioural State Machines
Ambler provides a set of guidelines when drawing state machines:
• Create a behavioural state machine for objects whose behaviour changes based
on the state of the object. In other words, do not create a behavioural state
machine for an object whose behaviour is always the same regardless of its state.
These objects are too simple.
• To adhere to the left -to-right and top-to-bottom reading conventions of Western
cultures, the initial state should be drawn in the top left corner of the diagram and
the final state should be drawn in the bottom right of the diagram.
• Make sure that the names of the states are simple, automatically obvious, and
descriptive.
• All transitions should be associated with a message and operation. Otherwise,
the state of the object could never change.
Creating a Behavioural State Machine
A five-step process used to create a state machine:
1. Set Context
2. Identify Object States
3. Lay Out Diagram
4. Add Transitions
5. Validate
Campus Housing Example
Library Example
CRUDE Analysis
• One useful technique to identify how the underlying objects in the
problem domain work together to collaborate in support of the use
cases is CRUDE analysis.
• CRUDE analysis uses a CRUDE matrix, in which each interaction
among objects is labelled with a letter for the type of interaction: C
for create, R for read or reference, U for update, D for delete, and E
for execute.
• In an object-oriented approach, a class/actor-by-class/actor matrix is
used. Each cell in the matrix represents the interaction between
instances of the classes.
Campus Housing Example
Library Example
Verifying & Validating the Behavioural Model
• First, all transitions contained in a behaviour state machine must be
associated with a message being sent on a sequence diagram, and it must
be classified as a (C)reate, (U)pdate, or (D)elete message in a CRUDE
matrix.
• Second, all entries in a CRUDE matrix imply a message being sent from an
actor or object to another actor or object. If the entry is a (C)reate,
(U)pdate, or (D)elete and the execution of the related operation changes
the state of the object, then there must be an associated transition in a
behavioural state machine that represents the instances of the receiving
class.
Activity

Create a state diagram that depicts the following scenario:


E-commerce guest house booking system registration process:
Create a state diagram to display the states of a listing.

The business process would be that a potential customer


would access the website and view the listing. That listing is
not bookable until the customer inserts their desired dates and
guest count. If there are no clashes, the listing is available to
rent. Once occupied, the listing is unavailable but becomes
available after checkout.
Activity
Exercises
1. Create a sequence diagram for the updating and sending a renewal request.
2. Draw a state diagram to show the possible states that a member can be in.
What Happens Next?

Week 6
• Read Chapter 7 – Moving to Design
• Complete the myLMS activities
Bibliography
Dennis, A., Tegarden, D. & Wixom, B. 2021. Systems Analysis and Design: An Object-Oriented Approach with UML. 6th ed.
USA: Wiley.

You might also like