Object Oriented Software Enginnering Lec 4
Object Oriented Software Enginnering Lec 4
(OOSE)
22CS017
Lecture (Theory)
Prepared By Dr. Dinesh Vij
Index
• Introduction to UML
• Goals of UML
• Characteristics of UML
• UML Building Blocks
• UML Modelling Software
• Introduction to Use Case Diagram
• Practice Questions
2
Introduction to UML
3
Goals of UML
4
Characteristics of UML
5
UML Building Blocks
6
Things
Things are the most important building blocks of UML. Things can be
−
• Structural
• Behavioral
• Grouping
• Annotational
7
Things (contd.)
1. Structural Things:
• They depict the static behavior of a model and display the physical and conceptual
components.
• They include class, object, interface, node, collaboration, component, and a use case.
⮚ Class: A Class is a set of identical things that outlines the functionality and properties of
an object. It also represents the abstract class whose functionalities are not defined. Its
notation is as follows;
8
Things (contd.)
⮚ Object: An individual that describes the behavior and the functions of a system. The notation
of the object is similar to that of the class; the only difference is that the object name is always
underlined and its notation is given below;
9
Things (contd.)
⮚ Collaboration: It represents the interaction between things that is done to meet the goal.
It is symbolized as a dotted ellipse with its name written inside it.
⮚ Use case: Use case is the core concept of object-oriented modeling. It portrays a set of
actions executed by a system to achieve the goal.
10
Things (contd.)
⮚ Actor: It comes under the use case diagrams. It is an object that interacts with the system,
for example, a user.
11
Things (contd.)
2. Behavioral Things:
12
Things (contd.)
i. Interaction:
• It is a behavior that comprises a set of messages exchanged among a set of objects or
roles within a particular context to accomplish a specific purpose.
• Graphically, a message is rendered as a directed line, almost always including the name
of its operation, as shown below
13
Things (contd.)
ii. State Machine
• It is a behavior that specifies the sequences of states an
object or an interaction goes through during its lifetime
in response to events, together with its responses to those
events.
14
Things (contd.)
iii. Activity
• It is a behavior that specifies the sequence of steps a
computational process performs.
• In an interaction, the focus is on the set of objects that
interact. In a state machine, the focus is on the life cycle
of one object at a time. In an activity, the focus is on the
flows among steps without regard to which object
performs each step.
• A step of an activity is called an action.
• Graphically, an action is rendered as a rounded rectangle
with a name indicating its purpose.
• States and actions are distinguished by their different
contexts.
15
Things (contd.)
3. Grouping Things:
• It is a method that together binds the elements of the UML model
• There is one primary kind of grouping thing, namely, packages.
• A package is a general-purpose mechanism for organizing the design itself, as opposed to
classes, which organize implementation constructs. Structural things, behavioral things,
and even other grouping things may be placed in a package.
• Unlike components (which exist at run time), a package is purely conceptual (meaning
that it exists only at development time).
• Graphically, a package is rendered as a tabbed folder, usually including only its name
and, sometimes, its contents
16
Things (contd.)
4. Annotational Things:
17
Relationships
• It illustrates the meaningful connections between things. There are four types of
relationships given below:
✔ Dependency
✔ Association
✔ Generalization
✔ Realization
18
Relationships (contd.)
2. Association:
• It is a structural relationship among classes that describes a set of links, a link being a
connection among objects that are instances of the classes.
• E.g.: city bus and riders.
• Aggregation is a special kind of association, representing a structural relationship
between a whole and its parts. E.g., shirt and pockets
• Graphically, an association is rendered as a solid line or it is denoted by a dotted line
with arrowheads on both sides to describe the relationship with the element on both
sides.
19
Relationships (contd.)
3. Generalization
• It is a specialization/generalization relationship in which the specialized element (the
child) builds on the specification of the generalized element (the parent).
• The child shares the structure and the behavior of the parent.
• E.g. vehicle is a bus, car, truck.
20
Relationships (contd.)
4. Realization
• It is a semantic relationship between classifiers, wherein one classifier specifies a
contract that another classifier guarantees to carry out.
21
Examples
Figure: Inheritance
22
Examples Cont..
23
Examples Cont..
24
Examples Cont..
25
UML Modelling Software
• "UML Modelling Software" refers to a computer program that allows users to create
visual diagrams using the Unified Modeling Language (UML), a standardized way to
represent the structure and behavior of a software system.
• Essentially acting like a "blueprint" for designing software applications by visually
depicting different components and their relationships through various types of
diagrams.
26
Diagrams in UML
27
Sequence Diagram
• Class diagrams, however, do not represent the dynamic behavior of the system
(how the system behaves when it performs some of its functions cannot be
represented by class diagrams).
• An interaction diagram typically captures the behavior of a use case and models
how the different objects in the system collaborate to implement the use case.
28
Sequence Diagram
31
Importance of Use Case
• Use cases have been used extensively over the past few decades.
• The advantages of Use cases include:
– The list of goal names provides the shortest summary of what the system will
offer.
– It gives an overview of the roles of each and every component in the system.
It will help us in defining the role of users, administrators, etc.
32
Relationships in Use case diagrams
In a Use Case Diagram, relationships play a crucial role in depicting the interactions
between actors and use cases.
1. Association Relationship
The Association Relationship represents a communication or interaction between an
actor and a use case. It is depicted by a line connecting the actor to the use case.
Example: Online Banking System
Actor: Customer
Use Case: Transfer Funds
Association: A line connecting the "Customer" actor to the "Transfer Funds" use case,
indicating the customer's involvement in the funds transfer process.
33
Relationships in Use case diagrams
2. Include Relationship
The Include Relationship indicates that a use case includes the functionality of another
use case. It is denoted by a dashed arrow pointing from the including use case to the
included use case. This relationship promotes modular and reusable design..
Example: Social Media Posting
• Use Cases: Compose Post, Add Image
• Include Relationship: The "Compose Post" use case includes the functionality of
"Add Image." Therefore, composing a post includes the action of adding an
image.
34
Relationships in Use case diagrams
3. Extend Relationship
The Extend Relationship illustrates that a use case can be extended by another use
case under specific conditions. It is represented by a dashed arrow with the keyword
"extend." This relationship is useful for handling optional or exceptional behavior.
Example: Flight Booking System
• Use Cases: Book Flight, Select Seat
• Extend Relationship: The "Select Seat" use case may extend the "Book Flight"
use case when the user wants to choose a specific seat, but it is an optional step.
35
Relationships in Use case diagrams
4. Generalization Relationship
The Generalization Relationship establishes an "is-a" connection between two use
cases, indicating that one use case is a specialized version of another. It is represented
by an arrow pointing from the specialized use case to the general use case.
Example: Vehicle Rental System
Use Cases: Rent Car, Rent Bike
Generalization Relationship: Both "Rent Car" and "Rent Bike" are specialized
versions of the general use case "Rent Vehicle."
36
How to draw a Use Case diagram in
UML?
Step 1: Identify Actors: Determine who or what interacts with the system. These are
your actors. They can be users, other systems, or external entities.
Step 2: Identify Use Cases: Identify the main functionalities or actions the system
must perform. These are your use cases. Each use case should represent a specific
piece of functionality.
Step 3: Connect Actors and Use Cases: Draw lines (associations) between actors
and the use cases they are involved in. This represents the interactions between actors
and the system.
Step 4: Add System Boundary: Draw a box around the actors and use cases to
represent the system boundary. This defines the scope of your system.
Step 5: Define Relationships: If certain use cases are related or if one use case is an
extension of another, you can indicate these relationships with appropriate notations.
Step 6: Review and Refine: Step back and review your diagram. Ensure that it
accurately represents the interactions and relationships in your system. Refine as
needed.
Step 7: Validate: Share your use case diagram with stakeholders and gather feedback.
Ensure that it aligns with their understanding of the system's functionality.
37
Example of Use Case Diagram
38
Contd…
The features of the system depends on the users of it.
• General use case
39
Contd…
• Monitor and Manage Patients’ Information and Status
Figure 3. Use case diagram of Monitor and Manage Patients’ Information and Status
40
Contd…
• Manage Hospital Rooms and Physicians’ Info and Status
Figure 4. Use case diagram of Manage Hospital Rooms and Physicians’ Info and Status
41
Contd…
• Monitor Hospital Transaction Records
42
Practice Questions
43
THANKS
44