0% found this document useful (0 votes)
2 views40 pages

Unified Modeling Language: Rwanda Coding Academy

The document provides an overview of the Unified Modeling Language (UML), detailing its purpose as a visual language for system design and communication among teams. It discusses various types of UML diagrams, including structural diagrams like class and deployment diagrams, as well as behavioral diagrams like use case diagrams. The document emphasizes the importance of UML in facilitating collaboration and understanding between technical and non-technical stakeholders in software development.
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)
2 views40 pages

Unified Modeling Language: Rwanda Coding Academy

The document provides an overview of the Unified Modeling Language (UML), detailing its purpose as a visual language for system design and communication among teams. It discusses various types of UML diagrams, including structural diagrams like class and deployment diagrams, as well as behavioral diagrams like use case diagrams. The document emphasizes the importance of UML in facilitating collaboration and understanding between technical and non-technical stakeholders in software development.
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/ 40

UML

Unified Modeling Language

AWET
Rwanda Coding Academy

February 4, 2025

1 / 39
Overview

1. Unified Modeling Language(UML)

2. 1.Structural UML Diagram: Class Diagram

3. 2. Structural UML Diagrams

4. 3.Behavioral

2 / 39
What is UML?

• Unified Modeling Language (UML) is a general-purpose modeling language.


• The main aim of UML is to define a standard way to visualize the way a system has
been designed. It is quite similar to blueprints used in other fields of engineering.
UML is not a programming language, it is rather a visual language.

3 / 39
Types of UML diagrams

• Types of UML diagrams (Use case diagrams, class diagrams, sequence diagrams,
activity diagrams, state machine diagrams, component diagrams, deployment
diagrams, package diagrams, object diagrams, etc.)

4 / 39
Why do we need UML?

• Complex applications need collaboration and planning from multiple teams and
hence require a clear and concise way to communicate amongst them.
• Businessmen do not understand code. So UML becomes essential to communicate
with non-programmers about essential requirements, functionalities, and processes of
the system.
• A lot of time is saved down the line when teams can visualize processes, user
interactions, and the static structure of the system(among experts) .

5 / 39
Different Types of UML Diagrams

• UML is linked with object-oriented


design and analysis. UML makes use of
elements and forms associations
between them to form diagrams.
Diagrams in UML can be broadly
classified as:
• From structural we are going to see
Class and Deployment diagram
• From behavioral we are going to see
usecase

Figure: Types of UML


6 / 39
Structural UML Diagram:class diagram

A. Class Diagram
• The most widely used UML diagram is the class diagram. It is the building block of
all object-oriented software systems. We use class diagrams to depict the static
structure of a system by showing the class hierarchy of the system, its methods, and
its attributes. Class diagrams also help us identify relationships between different
classes or objects.

7 / 39
CLASS DIAGRAMS(conts..)

• A class diagram describes the static structure of a system. It shows how a system
is structured rather than how it behaves. The static structure of a system
comprises many class diagrams and their dependencies. The main constituents of a
class diagram are classes and their relationships : generalization , aggregation ,
association , and various kinds of dependencies.

8 / 39
Class

• The classes represent entities with


common features, i.e. attributes and
operations.
• Classes are represented as solid
outline rectangles with
compartments
Figure: Example Class Diagram

9 / 39
Attributes

• An attribute is a named property of a class.


• It represents the kind of data that an object might contain.
• Attributes are listed with their names, and may optionally contain specification of
their type, an initial value, and constraints.
• Typically, the first letter of a class name is a small letter. An example for an
attribute is given.
Examples
bookName : String

10 / 39
Operations

• Operationis the implementation of a


service that can be requested from any
object of the class to affect behaviors.

Figure: operation

11 / 39
Association types

• They are association (the most common being bidirectional and unilateral
association), inheritance, realization/implementation, dependency, aggregation,
composition, and multiplicity.
• As mentioned above, class diagrams can represent relationships between classes.
There are seven relationships that are commonly shown in class diagrams

12 / 39
A. Association

• Between two other classes in an


association relationship, an association
class forms a part of it. Additional
information about the relationship could
be obtained by attaching the association
relationship with the association class.
Various operations, attributes, etc., are
present in the association class.

• is a broad term that encompasses just


about any logical connection or
relationship between classes. For Figure: Association
example, passengers and airline may be
linked as in side.
13 / 39
B. Directed Association

• This is a one-directional relationship in


a class diagram that ensures the flow of
control from one to another classifier.
• The navigability is specified by one of
the association ends. The relationship
between two classifiers could be
described by naming any association.
• An arrow indicates the direction of
navigation.

Figure: direct association


Figure: direct association

14 / 39
C. Reflexive Association

• This occurs when a class may have


multiple functions or responsibilities.
• For example, a staff member working in
an airport may be a pilot, aviation
engineer, ticket dispatcher, guard, or
maintenance crew member. If the
maintenance crew member is managed
Figure: reflexive
by the aviation engineer there could be
a managed by relationship in two
instances of the same class.

15 / 39
D. Multiplicity

• is the active logical association when


the cardinality of a class in relation to
another is being depicted.
• For example, one fleet may include
multiple airplanes, while one
commercial airplane may contain zero
to many passengers. The notation 0..*
in the diagram means “zero to many”.

Figure: Multiplicity 16 / 39
Multiplicity

17 / 39
E: Aggregation
• Refers to the formation of a particular
class as a result of one class being • aggregation, the classes nurture the
aggregated or built as a collection. For ‘has a relationship.
example, the class “library” is made up • A part can exist independently of the
of one or more books, among other whole.
materials.
• In aggregation, the contained classes
are not strongly dependent on the
lifecycle of the container.
• In the same example, books will remain
so even when the library is dissolved.
• To show aggregation in a diagram, draw
a line from the parent class to the child
class with a diamond shape near the Figure: Aggregation
parent class. 18 / 39
F. Composition

• It is a form of aggregation which


represents the whole-part relationship.
Here, the part classifier lifetime is
dependent on the whole classifier
lifetime. In a class, a strong life-cycle is
represented by the composition
relationship.
• There is usually a one-direction flow of
data here. It is generally indicated by a
solid line.
• A part cannot exist without the whole.
• A Student owns a StudentID card. Figure: Composition

19 / 39
G. Inheritance/Generalization

• refers to a type of relationship wherein


one associated class is a child of
another by virtue of assuming the same
functionalities of the parent class.
• In other words, the child class is a
specific type of the parent class. To
show inheritance in a UML diagram, a
solid line from the child class to the
parent class is drawn using an unfilled
arrowhead.
• ”Is-a” relationship (parent-child).
• A Student is a Person. Figure: Inheritance/Generalization

20 / 39
H. Realization

• denotes the implementation of the


functionality defined in one class by
another class. To show the relationship
in UML, a broken line with an unfilled
solid arrowhead is drawn from the class
that defines the functionality of the
class that implements the function.
• In the example, the printing preferences
that are set using the printer setup
interface are being implemented by the
printer.
• A class implements an interface. Figure: Realization

21 / 39
22 / 39
.
Structural UML Diagrams

Deployment Diagrams
• Deployment Diagrams Deployment diagrams are used to visualize the hardware
processors/ nodes/ devices of a system, the links of communication between
them and the placement of software files on that hardware.
• Deployment diagrams are commonly used to visualize physical hardware and
software of a system.
• Using it you can understand how the system will be physically deployed on the
hardware.
• Deployment diagrams help model the hardware topology of a system compared to
other UML diagram types which mostly outline the logical components of a system.

22 / 39
Structural UML Diagrams

Deployment Diagrams...
• Deployment Diagram is a type of diagram that specifies the physical hardware on
which the software system will execute.
• It also determines how the software is deployed on the underlying hardware. It maps
software pieces of a system to the device that are going to execute it.
• The deployment diagram maps the software architecture created in design to the
physical system architecture that executes it. In distributed systems, it models the
distribution of the software across the physical nodes.

23 / 39
Deployment Diagram Symbol and notations

A deployment diagram consists of the


following notations:
1. A node
2. A component
3. An artifact
Figure: Deployment Diagram Symbol and notations
4. An interface

24 / 39
What is an artifact?

Deployment Diagrams...
• An artifact represents the specification of a concrete real-world entity related to
software development. You can use the artifact to describe a framework which is
used during the software development process or an executable file. Artifacts are
deployed on the nodes. The most common artifacts are as follows,

Source files Scripts


Executable files DLL files
Database tables User manuals or documentation
Output files
Table: most common artifacts are as follows,

25 / 39
Artifacts....
• Artifacts are deployed on the nodes. It can provide physical manifestation for any
UML element. Generally, they manifest components. Artifacts are labeled with the
stereotypec <<artifact>> ,and it may have an artifact icon on the top right corner.
• Each artifact has a filename in its specification that indicates the physical location of
the artifact. An artifact can contain another artifact.
• It may be dependent on one another.Artifacts have their properties and behavior that
manipulates them.
• Generally, an artifact is represented as follows in the unified modeling language.

Figure: Enter Caption 26 / 39


Artifacts....
Artifact Instances
• An artifact instance represents an instance of a particular artifact. An artifact
instance is denoted with same symbol as that of the artifact except that the name is
underlined. UML diagram allows this to differentiate between the original artifact and
the instance.
• Each physical copy or a file is an instance of a unique artifact.
• Generally, an artifact instance is represented as follows in the unified modeling
language.

27 / 39
What is a node?

• Node is a computational resource upon which artifacts are deployed for execution. A
node is a physical thing that can execute one or more artifacts. A node may vary in
its size depending upon the size of the project.
• Node is an essential UML element that describes the execution of code and the
communication between various entities of a system. It is denoted by a 3D box with
the node-name written inside of it. Nodes help to convey the hardware which is used
to deploy the software.
• An association between nodes represents a communication path from which
information is exchanged in any direction.

28 / 39
nodes...
• Generally, a node has two stereotypes as follows:
• << device >> It is a node that represents a physical machine capable of performing
computations. A device can be a router or a server PC. It is represented using a node
with stereotype <<device>>.In the UML model, you can also nest one or more
devices within each other. Following is a representation of a device in UML:

29 / 39
nodes...
• << execution environment >>It is a node that represents an environment in
which software is going to execute. For example, Java applications are executed
in java virtual machine (JVM). JVM is considered as an execution environment for
Java applications. We can nest an execution environment into a device node. You
can net more than one execution environments in a single device node.
• Following is a representation of an execution environment in UML

30 / 39
Example of a Deployment diagram

Following deployment diagram represents the working of HTML5 video player in the
browser:

Figure: Example of deployment

31 / 39
Behavioral diagram:USE CASE DIAGRAM :

Use Case Diagrams


• The use case model for any system consists of a set of “use cases”.
• Intuitively, use cases represent the different ways in which a system can be used by
the users A simple way to find all the use cases of a system is to ask the question:
“What the users can do using the system?”
• Use cases correspond to the high-level functional requirements.

32 / 39
Behavioral diagram:USE CASE DIAGRAM :

• The use cases partition the system behavior into transactions, such that each
transaction performs some useful action from the user’s point of view.
• The purpose of a use case is to define a piece of coherent behavior without revealing
the internal structure of the system.
• The use cases do not mention any specific algorithm to be used or the internal data
representation, internal structure of the software, etc
• A use case typically represents a sequence of interactions between the user and the
system

33 / 39
Use case (cont..)

• In the use case diagram, each use case is represented by an ellipse with the name of
the use case written inside the ellipse .
• The All the ellipses (i.e. use cases) of a system are enclosed within a rectangle which
represents the system boundary.
• The different users of the system are represented by using the stick person icon.
• Each stick person icon is normally referred to as an actor.
• An actor is a role played by a user with respect to the system use.
• It indicates that the actor makes use of the functionality provided by the use case.
Both the human users and the 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¿¿.

34 / 39
Example

Figure: TikTok

• Tic-Tac-Toe Computer Game Tic-tac-toe is a computer game in which a human


player and the computer make alternative moves on a 3×3 square. A move consists
of marking previously unmarked square. The player who first places three consecutive
marks along a straight line on the square (i.e. along a row, column, or diagonal) wins
the game. As soon as either the human player or the computer wins, a message
congratulating the winner should be displayed. If neither player manages to get three
consecutive marks along a straight line, but all the squares on the board are filled up,
then the game is drawn. The computer always tries to win a game.
35 / 39
Example
• The use case model for the Tic-tac-toe problem is shown in answer below .This
software has only one use case “play move”. Note that the use case “get-user-move”
is not used here. The name “get-user-move” would be inappropriate because the use
cases should be named from the user’s perspective.

Figure: TikTok plays

36 / 39
Example 2

• A supermarket needs to develop the following software to encourage regular


customers. For this, the customer needs to supply his/her residence address,
telephone number, and the driving license number. Each customer who registers for
this scheme is assigned a unique customer number (CN) by the computer. A
customer can present his CN to the checkout staff when he makes any purchase. In
this case, the value of his purchase is credited against his CN. At the end of each
year, the supermarket intends to award surprise gifts to 10 customers who make the
highest total purchase over the year. Also, it intends to award a 22 caret gold coin to
every customer whose purchase exceeded Rs.10,000. The entries against the CN are
the reset on the day of every year after the prize winners’ lists are generated.

37 / 39
Example 2

38 / 39
The End

39 / 39

You might also like