Unified Modeling Language Class Diagram ..Uml)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Libyan Academy

Academy of Graduate Studies School of Applied


Science and Engineering
Department of Electrical & Computer
Division of Information Technology

A Work Entitled:

(Class Diagram)

Supervised by:
Dr. Mustafa Aswad
Student work:
Yasmeen altuwati
2022-2023

1
 General-purpose, developmental,
modeling language.
 Not a programming language.
 Reduce complexity by visualization.
 Direct relation with OOP.

2
3
 Static structure.
 Describes the structure of a system.
 Describes attributes, operations, and the relationships among
objects.

4
 Class Name
 The name of the class appears in the first partition.
 Class Attributes
 Attributes are shown in the second partition.
 The attribute type is shown after the colon.
 Attributes map onto member variables (data
members) in code.
 Class Operations (Methods)
 Operations are shown in the third partition. They are
services the class provides.
 The return type of a method is shown after the
colon at the end of the method signature.
 The return type of method parameters is shown
after the colon following the parameter name.
 Operations map onto class methods in code

5
 Public (+):
Accessible from all other genres.
 Private (-):
It can only be accessed from the internal definition of this
type.
 Package (~):
They can only be accessed within the package that includes
this type, and in any packages that you explicitly import.
 Protected (#):
It can only be accessed by this type and the types that
inherit from it.

6
 A class diagram shows all data models in a software
system, even complex ones.

 It provides an overview of how the application is


structured before studying the actual code, which makes
the work time much easier and less.

 Helps to better understand the general layouts of the


application

 It allows drawing detailed diagrams showing the code to be


programmed.

 Useful for developers and users.

7
 On class level:

 Inheritance (or Generalization):

Represents an
"is-a"
relationship.
Represents an
( )
Example:

8
 Abstract Class:
In UML, the abstract class has the same notation as that of
the class. The only difference between a class and an abstract
class is that the class name is strictly written in an italic
font.
 An interface :
is an empty shell. There are only the signatures of the
methods, which implies that the methods do not have a
body. The interface can't do anything. It's just a pattern.

9
1. Abstract classes can contain functions with implementation
commands, while interfaces do not allow this and only provide
definitions for the elements.
2. Abstract classes can contain what ordinary classes contain,
such as constructors and destructors, while the structure of
interfaces does not allow this.
3. A class can inherit from one abstract class, while it can
implement more than one interface.
4. Abstract classes begin with abstract while interfaces begin
with interface.
5. A class that uses an interface must redefine all its elements,
while in the case of inheriting from an abstract class, it is not
obligated to do so.

10
 Realization:
In UML modeling, a realization relationship is a relationship between two model
elements, in which one model element (the client) realizes the behavior that
the other model element (the supplier) specifies. Several clients can realize the
behavior of a single supplier.
Typically, realization relationships do not have names. If you name a realization,
the name is displayed beside to the realization connector in the diagram.
As the following figure illustrates, a realization is displayed in the diagram editor
as a dashed line with an unfilled arrowhead that points from the client (realizes
the
behavior) to the supplier (specifies the behavior).

(implementer) -------▻ (interface)

11
 Dependency:
Dependencies in UML indicate that a source element, also called
the client, and target element, also called the supplier, are
related so that the source element makes use of, or depends
upon, the target element. Changes in the behavior or
structure of the target may mean changes in the source.
represented by ( )

12
 Association:
 Simple Association:
Associations are relationships between classes in a UML Class
Diagram. They are represented by a solid line between classes
( ). Associations are typically named using a verb or
verb phrase which reflects the real world problem domain.

13
 Directed Association:
directed association
relationships are
associations that are
navigable in only one
direction.
A directed association
indicates that control
flows from one classifier
to another
represented by ( )
 Reflexive Association:
is an association between
instances of the same
class.

14
 Multiplicity
Place multiplicity notations near the ends of an association.
These symbols indicate the number of instances of one class
linked to one instance of the other class.
Example:

15
 Aggregation
 A special type of association.
 It represents a "part of" relationship.

 Objects of Class1 and Class2 have separate lifetimes.

The figure below shows an example of aggregation. The


relationship is displayed as a solid line with a unfilled
diamond at the association ( ).

16
 Composition
 A special type of aggregation where parts are destroyed
when the whole is destroyed.
 Objects of Class2 live and die with Class1.

 Class2 cannot stand by itself.

The figure below shows an example of composition. The


relationship is displayed as a solid line with a filled
diamond at the association end, which is connected to
the class that represents the whole or composite
( ).

17
 This is an example of how a
class diagram is used to
present the backend system
of an ATM Machine. The
ATM is a model system
that has a card reader, a
bank account holder, and a
printer. Each component
can send information to
each other as well as to the
machine itself while
maintaining layers of
security to keep your bank
account protected.
 Passenger Services IT
System

18
 Tool to create UML:
 Microsoft Visio.
 Moqups.
 Miro.
 Lucid chart.
 Draw.io.
 The figure shows the representation of the types of
relationships in class diagram.

19
 UML Class Diagram Tutorial / visual paradigm https://www.visual-
paradigm.com/guide/uml-unified-modeling-language/uml-class-diagram-
tutorial/.
 How to Make a Class Diagram [+Examples]
BY LETÍCIA FONSECA, MAY 26, 2022
HTTPS://VENNGAGE.COM/BLOG/CLASS-DIAGRAM/.
 UML Class Diagram Tutorial: Abstract Class with Examples
By Alyssa Walker Updated October 22, 2022
https://www.guru99.com/uml-class-diagram.html.
 Relationships in class diagrams Last Updated: 2021-03-02
https://www.ibm.com/docs/en/rational-soft-
arch/9.7.0?topic=diagrams-relationships-in-class.
 Object-Oriented Software Engineering Using UML, Patterns, and Java,
3e Bernd Bruegge, Allen H. Dutoit.

20

You might also like