0% found this document useful (0 votes)
3 views46 pages

Chapter 2

The document provides an overview of the Unified Modeling Language (UML), detailing its purpose, building blocks, and various types of diagrams used for modeling software systems. It explains how UML can visualize, specify, and document system artifacts, and outlines the relationships between different components, including dependency, association, generalization, and realization. Additionally, it covers specific UML diagrams such as use case, sequence, activity, collaboration, class, component, deployment, and state diagrams, emphasizing their roles in system analysis and design.

Uploaded by

mezigebu24
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)
3 views46 pages

Chapter 2

The document provides an overview of the Unified Modeling Language (UML), detailing its purpose, building blocks, and various types of diagrams used for modeling software systems. It explains how UML can visualize, specify, and document system artifacts, and outlines the relationships between different components, including dependency, association, generalization, and realization. Additionally, it covers specific UML diagrams such as use case, sequence, activity, collaboration, class, component, deployment, and state diagrams, emphasizing their roles in system analysis and design.

Uploaded by

mezigebu24
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

INFOLINK UNIVERSITY COLLEGE

11/20/2023
DEPARTMENT OF COMPUTER SCIENCE

1
2 11/20/2023
Chapter Two
Unified Modelling Language(UML)
2.1. Where Can the UML Be Used
♥ UML, as the name implies, is a modelling language. It may be
used to visualize, specify, construct, and document the artifacts
of a software system.
♥ It provides a set of notations (e.g. rectangles, lines, ellipses,
etc.) to create a visual model of the system.
♥ Like any other language, UML has its own syntax (symbols
and sentence formation rules) and semantics (meanings of
symbols and sentences).
3 11/20/2023

♥ Also, we should clearly understand that UML is not a system


design or development methodology, but can be used to
document object-oriented and analysis results obtained using
some methodology.

♥ UML can be used to construct nine different types of


diagrams to capture five different views of a system.

♥ UML diagrams provide different perspectives of the software


system to be developed and facilitate a comprehensive
understanding of the system.
4 11/20/2023

 The UML diagrams can capture the following five views of a


system:
• User’s view
• Structural view
• Behavioral view
• Implementation view
• Environmental view
5 11/20/2023

2.2 UML-Building Blocks

♥ UML is composed of three main building blocks, i.e., things,


relationships, and diagrams.

♥ Building blocks generate one complete UML model diagram


by rotating around several different blocks.

♥ It plays an essential role in developing UML diagrams. The


basic UML building blocks are enlisted below:
1. Things
2. Relationships
3. Diagrams
6 11/20/2023

2.3 Relationships in the UML

♥ Relationships depict a connection between several things, such

as structural, behavioural, or grouping things in the unified

modelling language.

♥ Since it is termed as a link, it demonstrates how things are

interrelated to each other at the time of system execution.

♥ It constitutes four types of relationships, i.e., dependency,

association, generalization, and realization.


7 11/20/2023

1. Dependency

♥ Whenever there is a change in either the structure or the

behaviour of the class that affects the other class, such a

relationship is termed as a dependency.

♥ Or, simply, we can say a class contained in other class is

known as dependency.
8 11/20/2023

2. Association
♥ Association is a structural relationship that represents how two

entities are linked or connected to each other within a system.

♥ It can form several types of associations, such as one-to-one,

one-to-many, many-to-one, and many-to-many.


9 11/20/2023

2.1 Aggregation

♥ An aggregation is a special form of association. It portrays a


part-of relationship.

♥ It forms a binary relationship, which means it cannot include


more than two classes. It is also known as Has-a relationship.

♥ It specifies the direction of an object contained in another


object. In aggregation, a child can exist independent of the
parent.
2.2 Composition
♥ In a composition relationship, the child depends on the parent. It
forms a two-way relationship. It is a special case of
10 11/20/2023

3 Generalization

♥ The generalization relationship implements the object-oriented

concept called inheritance or is-a relationship.

♥ It exists between two objects (things or entities), such that one

entity is a parent (superclass or base class), and the other one is

a child (subclass or derived class).

♥ These are represented in terms of inheritance. Any child can

access, update, or inherit the functionality, structure, and

behaviour of the parent.


11 11/20/2023

4. Realization
♥ It is a kind of relationship in which one thing specifies the
behaviour or a responsibility to be carried out, and the other
thing carries out that behaviour.

♥ It can be represented on a class diagram or component


diagrams.

♥ The realization relationship is constituted between interfaces,


classes, packages, and components to link a client element to
the supplier element.
12 11/20/2023

2.4. Diagrams in the UML.


2.4.1. Use Case Diagrams
♥ The use case model for any system consists of a set of use
case.
♥ The purpose of a use case is to define a piece of coherent
behaviour without revealing the internal structure of the
system.
♥ A use case typically involves a sequence of interactions
between the user and the system.
♥ Even for the same use case, there can be several different
sequences of interactions.
13 11/20/2023

♥ A use case consists of one main line sequence and several


alternate sequences.

♥ The main line sequence represents the interactions between a


user and the system that normally take place.

♥ The mainline sequence is the most frequently occurring


sequence of interaction.

♥ In contrast to all other types of UML diagrams, the use case


model represents a functional or process model of a system.
14 11/20/2023

Representation of Use Cases

♥ A use case model can be documented by drawing a use case


diagram and writing an accompanying text elaborating the
drawing.

♥ In the use case diagram, each use case is represented by an


ellipse with the name of the use case written inside the ellipse.

♥ All the ellipses (i.e. use cases) of a system are enclosed within
a rectangle which represents the system boundary.

♥ The name of the system being modelled (e.g., library


information system ) appears inside the rectangle.
15 11/20/2023

Figure 2.1 Use case diagram for library information system


16 11/20/2023

….cont’d
♥ The different users of the system are represented by using stick
person icons.
♥ Each stick person icon is referred to as an actor. An actor is a
role played by a user with respect to the system use.
♥ An actor can participate in one or more use cases. The line
connecting an actor and the use case is called the
communication relationship.
♥ Both human users and external systems can be represented by
stick person icons. When a stick person icon represents an
external system, it is annotated by the stereotype <<external
system>>.
17 11/20/2023

♥ You can draw a rectangle around the use cases, called the
system boundary box, to indicate the scope of your system.

♥ Anything within the box represents functionality that is in


scope and anything outside the box is not.
18 11/20/2023

♥ The includes relationship implies one use case includes the


behaviour of another use case in its sequence of events and
actions.

♥ Decompose a large and complex use case into more


manageable parts. The includes relationship is represented
using a predefined stereotype <<include>>.

♥ In the includes relationship, a base use case includes the


behaviour of the common use case.
19 11/20/2023

♥ The main idea behind the extends relationship among use


cases is that it allows you show optional system behaviour.

♥ An optional system behaviour is executed only if certain


conditions hold.

♥ The extending use case can add additional behaviour only at an


extension point only when certain conditions are satisfied.
<<extends>> Common
Base use
case use case
20 11/20/2023

Why Develop the Use Case Diagram?

♥ One possible use of identifying the different types of users


(actors) is in implementing a security mechanism through a
login system.

♥ Another important use is in designing the user interface in the


implementation of the use case for each category of users.

♥ Another possible use is in preparing the documentation (e.g.


users’ manual) targeted at each category of user.

♥ Further, actors help in identifying the use cases and


understanding the exact functioning of the system.
21 11/20/2023

Text Description

♥ Each ellipse in a use case diagram, by itself conveys very little


information, other than giving a hazy idea about the use case.
♥ Therefore, every use case diagram should be accompanied by a
text description.
♥ The following are some of the information which may be included
in a use case text description in addition to the mainline sequence,
and the alternate scenarios.
♥ Actors
♥ Pre-condition: The preconditions would describe the state of the
system before the use case execution starts.
22 11/20/2023

♥ Post-condition: This captures the state of the system after the


use case has successfully completed.

♥ Non-functional requirements : This could contain the


important constraints for the design and implementation, such
as platform and environment conditions, qualitative
statements, response time requirements, etc.

♥ Exceptions, error situations: This contains only the domain-


related errors such as lack of user’s access rights, invalid entry
in the input fields, etc.
23 11/20/2023

974847688
UML Sequence Diagram
Purpose
 A sequence diagram is used in UML to describe the analysis and
design phases.
 It's an interaction diagram that details how operations are carried out.
 A sequence diagram is often used to depict the chronologically-
structured event flow through a use case.
 It's good at presenting the communication relationships between
objects; and what messages trigger those communications.
25 11/20/2023

Usage of Sequence Diagram


 Sequence diagrams are a type of interaction diagram that focus on the
flow of messages between objects and the order in which those
messages are sent. They are used to visualize the interactions between
different components in a system.
 They can be complete, lost or found; synchronous or asynchronous;
call or signal. Activate is used to denote participant activation.
 Once a participant is activated, its lifeline appears.
 The objects are model elements that represent instances of a class or
classes.
 The classes in UML show architecture and features of the designed
system. The actor specifies a role played by a user or any other system
that interacts with the subject.
Modeling Sequence Diagram
UML Activity Diagram
 An activity diagram is a diagram that illustrates the flow of activities in a
system.
 It is commonly used in the field of software engineering to visualize the
workflow of a system.
The activity diagrams consist of activities, states, and transitions between
activities and states.
 The initial state is the starting point in the activity diagram. It is the point at
which you begin reading the action sequence.
 An activity is a unit of work that needs to be carried out. The state defines
the current condition of an event or activity.
Cont…
 Decision activity is introduced in UML to support conditionals in
activities. It shows where the exit transition from a state or activity may
branch in alternative directions depending on a condition.
 The bar represents the synchronization of the completion of those
activities.
 Control flow in computer science refers to the order in which the
individual statements, instructions, or function calls of an imperative or a
declarative program are executed or evaluated.
 An object flow is the same thing as control flow, but it is shown as a
dashed line instead of a solid one.
Activity Diagram
UML Collaboration Diagram
 A collaboration diagram is used to describe a collection of objects that
interact to implement some behavior within a context.
 It's used to model system functionality, which is more specifically, visualize
the relationship between objects collaborating to perform a particular task
and model the logic of the implementation for a complex operation.
 The collaboration diagram is also called a communication diagram or
interaction diagram.
 It consists of an object, multi-object, actor, association role, delegation, link
to self, constraint, and note. Objects are model elements that represent
instances of a class or classes.
 A multi-object represents a set of lifeline instances. A link-to-self is used to
link a message which can be sent from an object to itself.
Collaboration Diagram
UML Class Diagram
 A class diagram is a type of static structure diagram that describes
the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among
the classes.
 A UML class diagram is not only used to describe the object and
information structures in an application, but also show the
communication with its users.
 It provides a wide range of usages, from modeling the static view
of an application to describing responsibilities for a system.
 The composition is a special type of aggregation that denotes
strong ownership.
33 11/20/2023

Usage of class diagram


 In a UML class diagram, classes represent an abstraction of entities
with common characteristics.
 Associations represent static relationships between classes.
Aggregation is a special type of association in which objects are
assembled or configured together to create a more complex object.
 Generalization is a relationship in which one model element (the
child) is based on another model element (the parent).
 Dependency relationship is a relationship in which one aspect, the
client, uses or depends on another aspect, the supplier.
Category
Cont..
Function

Activity edges Represent the flow between activities

Indicate that instances of one model element are


Associations
connected to instances of another model element

Indicate that a change to one model element can


Dependencies
affect another model element

Indicate that one model element is a specialization


Generalizations
of another model element

Indicate that one model element provides a


Realizations specification that another model element
implements
Transitions Represent changes in state
Class Diagram
 Analysis level Class Diagram
Cont…
UML Component Diagram
 A component diagram is a type of structural diagram in the Unified
Modeling Language (UML) that depicts the organization and
dependencies among the components in a system. It is used to illustrate
the components of a system and their relationships.
 It allows application designers to verify that a system's required
functionality is being implemented by components, thus ensuring that the
final system will be acceptable.
 What's more, the component diagram is a useful communication tool
among stakeholders to discuss, analyze, or improve system design.
 The UML component diagram doesn't require many notations, thus very
easy to draw. Below is a UML component diagram example, requiring
only two symbols: component and dependency.
UML Deployment Diagram
 A deployment diagram in the context of software engineering
illustrates the physical deployment of the system components into a
production environment. It shows the configuration of the hardware
and software components and the relationships between them.
 A deployment diagram is a type of diagram used in UML to describe
the hardware components used in system implementations and the
execution environments and artifacts deployed on the hardware.
 It allows you to visualize the hardware topology system, model
physical hardware elements, and the communication relationship
between them, and plan the architecture of the system.
40 11/20/2023

Usage

 Nodes represent either hardware devices or software execution


environments.
 They could be connected through communication paths to create
network systems of arbitrary complexity.
 A component represents a modular part of a system. A component
defines its behavior in terms of provided and required interfaces.
 Dependency relationship is a relationship in which one element, the
client, uses or depends on another aspect, the supplier.
Deployment Diagram
UML State Diagram

 The state chart diagrams allow you to model the dynamic nature of a
system. They describe all of the possible states of an object as events occur.
So the most important purpose of a state chart diagram is to model the
lifetime of an object from creation to termination.
 A state is a condition during the life of an object during which it satisfies
some requirements, performs some activities, or waits for some external
events.
 A start state is a state that a new object will be in immediately following its
creation. An end state is a state that represents the object going out of
existence.
 A transition is a relationship between two states indicating that an object in
the first state will perform certain actions and enter the second state when a
specified set of events and conditions are satisfied.
State Chart Diagram
UML Package Diagram

 The package diagrams allow you to organize the elements of a model. They
are typically used to depict the high-level organization of a software project.
The package diagram can show both structure and dependencies between
sub-systems or modules.
 They can be used to group any construct in the UML, such as classes,
actors, and use cases.
 The package element in UML is represented by a folder icon. Each package
represents a namespace.
 Packages can also be members of other packages, providing for a hierarchic
structure in which top-level packages are broken down into sub-packages.
Package Diagram
Difference between UML modes

You might also like