Ooad Unit 3
Ooad Unit 3
3.0 Introduction
3.1 Objectives
3.2 Basics of Behavioral Modelling
3.3 Interactions
3.4 Use Cases and Use Case Diagram
3.5 Interaction Diagram
3.5.1 Sequence Diagram
3.5.2 Collabration Diagram
3.6 Activity Diagram
3.7 CRUDE Analysis
3.8 Summary
3.9 Solutions/ Answer to Check your Progress
3.10 References / Further Reading
3.0 INTRODUCTION
Object-Oriented Modeling (OOM) is used for modeling the application from the
initial stage of the software development. There are different types of objects used in
modelling. Every object has its shape and size. It is used to store the information in a
single unit. Every value has assigned a unique name which is identified from its
reference. Every element of an object has its own property.
Objects are created and executed by describing them inside the program. Each object
is defined in two ways: system-defined objects and user-defined objects. Every object
has its class and instances. A class of objects is defined by declaring the instances of
the class.
The object's instance is based on the set of rules in the class. In an object, a data
element is also known as a property, while the object contains for processing the
values are called methods. Objects cannot store only the data, but they can store the
instructions on what to do with the data.
A model is a representation of something ( object, system, process) in one medium or
another. A model of software is designed in a language is called UML. The
classification of UML diagrams is shown in figure 3.1. It can represent semantics and
notation forms which include text and picture. We can divide it into three parts:
structural classification, dynamic behaviour, and model management.
The first part is the structural classification, which describes the relationship
between one object to another object; while the classifier describes the Static
view, Use Case view, and Implementation view.
Dynamic behaviour depicts the behaviour of a system with time. Behaviour
can be changed with time and can be represented using a State Machine,
Activity, and Interaction Diagrams.
1
NG Model management is the third part that describes the organization in a
hierarchical structure.
UM iagram
ehavior
Structure
Activity
State
Use
Sequence
Communication
Class
Component
atabase iagram
iagram
Machine
Case
iagram
eployment iagram
iagram
iagram
iagram
iagram
3.1 OBJECTIVES
After going through this unit, you should be able to:
Explain behavioural models,
Explain the rules and roadmap of sequence and communication diagrams,
Describe the process used to produce sequence and communication diagrams,
Explain the relation between the behavioural models, structural and functional
models and,
Create sequence diagram, collaboration diagram, and CRUDE matrix.
This unit, focus on various behavior models with the help of interaction diagrams
(sequence and communication diagrams) and activity diagrams. It is easy to provide a
complete structure of the dynamic aspects of the evolving business information
system with the help of behaviour model. This unit first, describe the behavioural
OOAD
models and their components. Then describe each diagram and its notations, how they
are created, and how they are related to the functional and structural model of the
existing system.
3.3 INTERACTIONS
In every active system, objects interacts with each other by passing messages. An
interaction is a behaviour of objects, by passing a set of messages among objects, we
try to achieve some objectives.
OBJECT DIAGRAM
If we use an object diagram, then the unlimited number of instances are available in
nature and need to be considered its impact on the system.
Following things should be considered and understood clearly during the construction
of the object diagram.
3
NG used as a verb or noun for the action with some description. Some of the action names
are given below:
Fill Order
Check-In
Course Enrolment
Display Error
ank Transaction
Clock
displayTime
second
minute
hour
SIGNAL: When an activity performs any operation then it sends and receives
messages, which is known as signals. It is an asynchronous event. In the given figure
<<CSE201: Seminar>> represent the signal and the parameter of signal is term=
“Final”.
͟Seminar
:term
Final
CS
0
LINK: It is used for establishing a relationship between objects and classes of the
system. Link is represented by a line. It is a conceptual or physical connection
between two objects. For example, Akash studies at the University, explains the
connection of a student with a University.
LINK ATTRIBUTES: It assigns the value of a specific instance of the link; for each
pair of the object, there is a particular value associated with each attribute. As shown
in figure 3.4, "orderNumber" is a link attribute. The system represents that the
customer and order placed into the Number, and each order has an orderNumber.
Number
Order
Customer
makesOrder
orderNumber
order
orderType
ate
OOAD
Figure 3.4: Link Attributes
The notation for class, attribute, and operation is shown in figure 3.5. Customer and
order are two classes of the class diagram. These classes represent a one-to-many
relationship because a customer can issue multiple orders. Customer class have two
functions: sendOrder() and receiveOrder() while Order class have two functions:
confirm() and close(). Order classes have abstract classes, which are represented as
SpecialOrder and NormalOrder classes. The two inherited classes use two additional
functions like dispatch() and receive() with all the properties.
In figure 3.6, the object diagram describes the scholar who can go to attend "Seminar"
can be "Wait Listed" for attending it, or it may be a "Teaching Assistant" for it. In the
object diagram, Alok and Amar are research assistants in CSE 201, while Shruti is
teaching assistance "TA" for CSE 201, Shreya is research assistance "RA", and Neha
is "Wait Listed". Object diagram also describes that the Seminar is the instance of the
Course Research Methodology "RM" class. Here, the object diagram generates the
three relationships between seminars and research assistants and the two relationships
between the course and seminars.
5
MI
:͟Seminar
Sterm
Final
CCS
0Seha isted
hreya
Research
Shruti
Alok
Aman
Teaching
Course
name
N Methodology
Wait Assistant
NG
a) External parameter
b) Internal parameter
c) Both (a) and (b)
d) None of the above
2) Every action has.........
a) Input
b) Output
c) Input and output
d) None of the above
3) Signals perform any operation by..........
a) Sending messages
b) Receiving messages
c) Sending and receiving messages
d) None of the above
OOAD
SYSTEM: A system boundary defines the scope of a system. Rectangles are used to
draw system boundaries that contain a use-case, and actors are used outside the
system boundaries. The system can work only with limited functionalities. Use-case
needs to have appropriately defined limits.
System Name
7
NG USE CASE: It is used to describe a part of the system's functionality that enables
access to the functionalities. It is represented using the ovals. Label the ovals with
verbs that represent the system's function. The objective behind use-cases is to
describe interactions. The flow of batch processing, which generally does not include
interactions, can also be used as a use-case.
Use Case
ACTORS: The users of a system perform the role of actors in the use-case diagram.
An actor performs as an entity with fixed roles in each system. In the situation when
one system is the actor of another system, label the actor system with the actor image.
The system needs to manage the role of a person or entity which is working as an
actor. For example, actors may have various roles like administrator or user. In each
case, the appropriate functionalities of the Use Case are granted. All the actors are not
part of the system. A person who performs services to the counter is also known as
the actor. For example, for modeling a hospital application, a doctor and patient entity
represent an actor in the application. Typically, an actor plays a role that a human, a
hardware device, or maybe another system plays with the system.
Customer
ROLE OF ACTORS: An actor is a user or external system that moves a system. The
role of an actor is equated with determining the behaviour of the associated
system—for example, different types of actors perform the activity at the Bank ATM.
Bank customers and card holders are the main actors, while customerAs and cardAs
participate as a sub-actor of the system.
There are various actors associated with the ATM system, which are as follows:
A Bank Customer can withdraw money, check the balance, deposit cash, and
deposit cheque from the ATM.
A Card Holder can use a credit card and debit card to withdraw the money
from the ATM.
A customerIs can access the ATM for various types of ATM transactions.
A cardAs is responsible for credit card and debit card to withdraw the amount
from the ATM.
eposit
Check
Withdraw
cardAs Checque
Cash
alance
CustomerIs
ank
Card Money
Customer
Holder
OOAD
In figure 3.8, the Use Case diagram represents the Order management system. In this
diagram, three Use Cases Food Order, LunchOrder, and BreakfastOrder and one actor
in the role of user or customer are there. The LunchOrder and BreakfastOrder are the
extensions of the Use Case Order. Therefore, they have extended relationships. In the
given diagram, the actor Customer lies outside the system as it is an external user of
the system.
DEPENDENCIES
Every model consists of many Use Cases. These Use Cases are used to define the
different functionalities of a system. There are two types of dependencies known as
include and extended dependencies, which are used in Use-Case. Dependencies
information is used by the Use Case to execute a system functionalities. How these
9
NG Use Cases are related to one another is also defined using dependencies. These
dependencies are defined as follows:
INCLUDE DEPENDENCIES
Specialized types of dependencies are known as include dependencies. There are
different possibilities to log the activities of a project management system. These
possibilities may be as project managers, resource managers, and system
administrators to interact with the system. Figure 3.9 elaborates the Use Case, while
the second figure defines the activities of the project manager, resource manager, and
system administrators as they log into the system and they are using the Use Cases of
the diagram.
Project
ackup Manager
Administer
Manage
Activity
Resource
System
actor
System System
Project
Resource
Managerandand
and
Administrator og
ogog
Include dependency is used to make the relationship between one Use Case (called a
base case) to another Use Case (called an inclusion Use Case). The base Use Case is
called the inclusion Use Case. It is shown by the dashed arrow line from the base Use
Case to the inclusion case, as shown in figure 3.10. The base Use Case monitors the
behaviour sequence of the step to include the inclusion Use Case.
extend
Manage
Maintain Project
Task
System
Activity
Project Manager OOAD
Include dependency behaviour is the same as a Use Case. It is common to other Use
Cases and added as different Use Cases which can be reused in other Use Cases. In
figure 3.9, the log activity of the Use Case is included in the Manage Project, Manage
Resource, and Administer System Use Cases.
EXTEND DEPENDENCIES
In figure 3.11, the Use Case with optional behaviour is made with various activities
and tasks. Various activities are performed during the execution of the project. The
Project Manager manages projects by maintaining the system activities and its tasks.
It also addresses the situations by adding the behaviour of Use Cases.
An extended dependency extends the Use Case from one Use Case (known as the
extension Use Case) to another Use Case (known as base Use Case). A single Use
Case may cover multiple Use Cases or multiple Use Cases covered by the single Use
Case by using the extended keyword. The base Use Case detects the behaviour
sequence of the extending Use Case added in the project. In figure 3.12, extend line is
denoted by the dashed arrow line to extend the above Use Cases.
11
extend
Manage
Task
the
an
Project Project
System
Activity itselfby Maintaining a
Manager
NG
It specifies the flows and events of a system. But remember that Use Case never
describes the details of the system, such as how behaviour is implemented. All the
input, output, and function are mentioned inside the black box. This information is
very useful for high-level design to get a complete picture of the system. Use Case
diagrams can be used for:
a) Static
b) Dynamic
c) Both (a) and (b)
d) None of them
2) Which element is not part of the Use Case diagram?
OOAD
a) System
b) Actor
c) Use Case
d) Class
3) An Actor is a part of ……………………. system.
a) Internal
b) External
c) Both (a) and (b)
d) None of them
4) Which is not a type of dependencies ………………………..
a) Include
b) Exclude
c) Extend
d) Remove
5) Draw an Automated Trading Housing System for Use Case?
…………………………………………………………………………………………
……...…………………………………………………………………………
…………………………...
Interaction diagram focus on the dynamic behaviour of the system. It provides us with
the dynamic context of an interaction between one or more lifelines of the system.
In UML, the interaction diagram is used for various purposes, which are as follows:
13
NG It shows the communication and sequence of messages passing in the system.
Some of the important points which are to be identified before drawing the interaction
diagram are as follows:
Sequence diagram and collaboration are used to represent the interaction diagram
which is discussed here:
Sequence diagrams are similar to method calls which do not describe the object
organization, whereas the collaboration diagram shows the object diagram.
Two diagrams are used for the selection of the requirement. If the time sequence is
preferred, then the sequence diagram is used, and when the organization is required,
then a collaboration diagram may be preferred.
a) Objects
b) Methods
c) Sequence
d) Relationships
3) What is Collaboration Diagram?
a) Object Diagram
b) Class Diagram
c) Method Diagram
d) None of them
…………………………………………………………………………………………
…………………………………………………………………………
Activity diagrams are the same as previous diagrams. It captures the dynamic
behaviour of the system. An activity diagram is used to express message flow from
one activity to another in a flow chart. It is a diagram that looks like a flow chart, but
it is not the same. It shows different flows like parallel, branched, single, and
concurrent. An activity diagram consists of the following behavioural elements:
Initial State/Start Point: It represents an activity diagram's initial state or start point.
It is denoted by a small, filled circle. The notation for the initial state is given below.
15
NG Activity or Action State: It represents the uninterruptible action of objects. It is
represented by a rectangle with rounded corners or edges.
Activity/Action State
Action flow or Control flows: Action flow shows the edges and paths from one
action state to another action. It is represented by an arrowed line.
Object Flow: It is used for the creation and modification of objects. An object flow
arrow shows an object actions, including the transition from one active state/object to
the other object.
Fill Order Receive Order
Order
Flow Final Node: It shows a circle with a cross inside. It shows the end of a single
control flow. The final activity node denotes the end of all control flows within the
activity.
Close Order
Time Event: It refers to an event that stops the flow for a time.
Activity
Merge Event: It is used to merge multiple flows that are not concurrent.
Signals: Signals are used to represent an activity to send and receive a message. It is
of two types: Input signal and Output signal. The input signal is represented by a
concave polygon (Message receiving) and the output signal is represented by a convex
polygon (message sending). The state of the signal can not be changed until a
response is received.
Activity
17
NG Final State/End State: An arrow is used to indicate the circle, and the inside filled
circle shows the end state or final state of the diagram.
The activity diagram shows the flowchart of activities. It shows the workflow between
various model activities. It looks like flowcharts, but they are an advancement of the
flowchart with some additional capabilities. Now let us see how to draw activity
diagram.
Once all the above items are identified, imagine the complete structure of the entire
system. This structure is then transformed into an activity diagram.
Activity diagrams show the flow from a start point to the endpoint with various
decision paths that exist in the system. Figure 3.16, shows the activity diagram for the
order management system. In this diagram, four main activities are identified which
are associated with conditions. It represents the various situations of parallel execution
of some activities. It is very useful for business modelling to explain the detailed
modelling activity of the entire diagram. It is used to represent the decision paths, but
the programmer’s code and activity diagram does not exactly match. Figure 3.16,
shows the four main activities, which are as follows:
In the above diagram, the customer sends an order request, order request confirm for
the receipt of the order, verify the conditions of the order, if it is a Lunch or Breakfast
order. After verifying the condition of the order, activity to confirm the order is
performed, dispatch the order, and then finally the end of the activity will be
performed as the termination of the process.
This diagram is implemented for business demands to model the various activities of
the system. It has focused on business understanding rather than on implementation
details. Activity diagram can be used for:
19
NG It is one of the useful techniques to identify the basic objects in the problem domain.
The CRUDE analysis is used to perform various activities of an object in the project
domain and collaborate in support of Use Case analysis. CRUDE matrix is used to
represent each interaction among objects is labelled for the various purpose, which is
as follows:
a) Static Behaviour
b) Dynamic Behaviour
c) Both (a) and (b)
d) None of the above
2) The activity diagram, initial/start state can be shown by___________
a) Circle
b) Filled Circle
c) Double Circle
d) Half Circle
3) Activities define the ……………... of the model.
OOAD
a) Business flow
b) Control Flow
c) Workflow
d) All the above
4) The CRUDE analysis does not perform the activities_____________
a) Create
b) Delete
c) Report
d) Update
5) Draw an activity diagram for email processing.
…………………………………………………………………………………………
…………………………………………………………………………………
………………………....................................................................
3.8 SUMMARY
Modelling is used for the developing application/services of the software. Different
types of objects are used in modelling. Every object behaves in different ways. The
behaviour model describes the internal parameter of an information system. Model of
a system behaves either static or dynamic. A Use Case diagram is a dynamic
behaviour in the system to represent the dynamic expressions of the system. Use Case
diagram is explained in detail in this unit. An interaction diagram is used to represent
the dynamic behaviour, and it consists of objects, relationships and messages. The
activity diagram represents the activities of dynamic behaviour. To capture the various
activities of objects and permissions within a system is represented by the CRUDE
matrix.
This unit provides the basic concepts of behavioural modelling notations. Prime
diagrams of the behavioural model are presented and discussed. A design has been
provided about various perspectives and their corresponding diagram. This unit also
represents various elements used in behavior diagrams.
1. b
2. c
3. c
4. c
Check your Progress 2:
21
NG 1. b
2. d
3. b
4. d
5. Use Case for Automated Trading House System
2. b
3. d
4. d
23