You are on page 1of 5

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/235635905

Formalizing class diagram in UML

Conference Paper · July 2011


DOI: 10.1109/ICSESS.2011.5982368

CITATIONS READS

2 293

3 authors:

Alireza Souri Mohammad ali Shariffloo


Islamic Azad University Tehran Science and Research Branch University College of Nabi Akram
45 PUBLICATIONS   332 CITATIONS    6 PUBLICATIONS   11 CITATIONS   

SEE PROFILE SEE PROFILE

Monire Norouzi
Islamic Azad University
22 PUBLICATIONS   68 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Power systems View project

Internet of Things application View project

All content following this page was uploaded by Alireza Souri on 28 May 2014.

The user has requested enhancement of the downloaded file.


Formalizing Class Diagram in UML

Alireza Souri Mohammad ali Sharifloo Monire Norouzi


Department of Engineering Department of Engineering Department of Engineering
University College of Nabi Akram University College of Nabi Akram University College of Nabi Akram
Tabriz, Iran Tabriz, Iran Tabriz, Iran
a.Souri@ucna.ac.ir m.Sharifloo@gmail.com Monire_Norouzi@yahoo.com

Abstract—one of the important methods for characterization, class defines the methods and variables in an object, which
development and realization of software and hardware is a abstraction of entity in a program or the unit of code
systems is formal method. Since there are not any necessary representing that entity. Class diagrams are useful in all
techniques for modeling in UML, by formalizing class forms of object-oriented programming (OOP). The
diagram – as important section of UML – in this paper we
concept is several years old but has been refined as OOP
can convert one system to class structure in UML easily. Also
we can determine all of the relationships between each class modeling paradigms have evolved.
in the system. Then by modeling this structure it will be In a class diagram, the classes are arranged in groups
prepare for some goals such as verifying and validating. By that share common characteristics. A class diagram
using an example we show procedure of formalizing the resembles a flowchart in which classes are portrayed as
system. After all, we come to a conclusion that formal method boxes, each box having three rectangles inside. The top
enhances ability of analyzing and developing a system. Also it rectangle contains the name of the class; the middle
causes well-responsibility in other techniques such as Formal rectangle contains the attributes of the class; the lower
Verification, Formal Validation and Software Testing. rectangle contains the methods, also called operations, of
Keywords-formal method; UML; class diagram; modeling;
the class. Lines, which may have arrows at one or both
formalizing ; relationships; ends, connect the boxes. These lines define the
relationships, also called associations, between the
I.INTRODUCTION classes[1].
Modeling is discussed in many sciences. For example
one part of designing software and hardware of systems Since class diagram has been developed widely, in this
can be modeled, verified and even evaluated by paper we selected class diagram in order to formalizing the
mathematic analyzes and logic commands. systems, too.
A model is simplified the whole existence. Originally a
model provides a map of a system. Models maybe include III.FORMALIZING CLASS STRUCTURE
whole details of a system. So in general we can say that a By formalizing a system using class diagram, we need
good model is a model that can determine all the elements to show all of the entities, specifications and behavior of
involved in the plan, relationships between them and how the system as a class diagram.
effective they can be. Each system explained by several Each system has some subsystems for converting a
models and there is a semantic map which describes the system to class diagram. We should create one main class
system in each model. and then convert subsystems to subclasses in main class.
For classifying one class we should define some
Now, by these fragments, why do we want to variables and values we can show one system as followed
modeling? We want to model a system in order to have a set:
good understanding of the system which we want to System: {Type, Classes, Attributes, Variables};
implement better.
Modeling is central part of all activities that guide the x Type: determines type of system. Type of system
software developers to good product. can be Basic , Real time ,distribute , embedded ,
fuzzy and etc.
II.CLASS DIAGRAM x Class: determines name of classes that have been
A class diagram is an illustration of the relationships classified and are connected together based on
and source code dependencies among classes in the subsystems in the system.
Unified Modeling Language (UML). The Unified x Attribute: determines attributes of system which
Modeling Language (UML) is the de facto standard are used for connecting to the classes in the
formalism for object-oriented modeling[2]. In this paper, a system.

___________________________________
978-1-4244-9697-6/11/$26.00 ©2011 IEEE

524
x Variables: determines Inputs, Outputs and the For example :
amount of Data of system which are placed as {c1 , c2 , ci } ∈ C
variables in the classes.
Now, when all states of the system converted to the { v1 , v2 , vi } ∈ V
class, we demonstrate all the relationships between { at_1 , at_2 } ∈ At
elements of each class by each other. at_1 : ci Æ vi => vi ∈ ( public , private , protected ,
Each class can have communications to its elements: package , initial ) = ( 1 , 0 ,1 ,0 ,0 )
(Active, Module , finite ) ∈ C
x Boolean type := active : shows activity of class Therefore we should place vi in Operation section of
x Boolean type := Module : shows the main class
x Boolean type := finite : shows that the class is ci class.
finite For demonstrating the relationships in the class
diagram we have :
Variables can communicate to their elements: x Association : the association between two classes
(public, private , protected , package , initial ) ∈ V is shown by
x Inheritance : one or more inherited sets of one
Also, Attributes can communicate to their elements: class are shown by
( type, enable ) ∈ At x Dependency : dependency of one or more classes
to another class is shown by ----- >
Ways of relationships between elements of system are: x Aggregation : a set of one class is created by
C & At : V or At : C Æ V collection of several classes that is shown by

Now, after explaining formula and variables, we create According to above explanations we convert the
relationships between classes. We define three variables relationships between classes as class diagram :
which are in structure of each class for creating
relationships between classes: The Roles of classes :
{ Extend , Attribute , Operation } ; Extend : Ω
Attribute: δ
When two same attributes from two different classes Operation: θ
give us a same result, we should place name of the second
class in Extend section of the first class. Inheritance
For example, in converting class relationships to the ci ∈ C { The name of all Classes }
formulas like follow:
i ∈ C { The name of all Classes} – { ci }
{c1 , c2 } ∈ C
If ci ∈ i . Ω
{ v1 , v2 } ∈ V
{ at_1 , at_2 } ∈ At
According to above formulas, whenever there was a class
at_1 : c1 Æ v1
at_1 : c2 Æ v1 like ci in Extend section of i class , i class inherits from ci
class.
We should place name of c2 class in Extend section of
c1 class at the above formulas. Aggregation :
Whenever Protected element enables in set of V , we m ∈ { The name of all Classes }
should place the name of V in the Attribute section of ci ∈ { The name of all Classes} – {m}
resulted class. if ci ∈ m . δ
For example :
{c1 , c2 , ci } ∈ C According to above formulas, whenever there was a class
like ci in Attribute section of m class , m class aggregate
{ v1 , v2 , vi } ∈ V
from ci class.
{ at_1 , at_2 } ∈ At
at_1 : ci Æ vi => vi ∈ ( public , private , protected , Dependency:
package , initial ) = ( 0 , 0 ,1 ,0 ,0 ) z ∈ { The name of all Classes }
Therefore we should place vi in Attribute section of ci Ci ∈ { The name of all Classes} – {z}
class. if Ci ∈ z . θ = " Public {z} purpose …"
Whenever Public element enables in set of V , we
should place the name of V in the Operation section of According to above formulas, whenever there was a class
resulted class. like ci in Operation section of z class , ci class dependence
to z class.

525
Now, for understanding those formulas we have this public Report generateNewsReport()
example public void addGuages (TemperatureGauge newTG,
In this example, we formalize a Weather System by WindSpeedGauge newWG);
using top roles. Also we convert the system to class
diagram and show relationships between classes. ________________________
The classes in this system are :
C := { News Window , Report , Report Generator , Class: Weather Report
Weather Report , News Report , Temperature Gauge , Extends: Report
Wind Speed Gauge , Display Area } Attributes:
For example, name of Report class has been placed in protected double temp
Extend section of News Report class. So there is protected double windSpeed
inheritance relationship between these two classes that all Operations:
the relationships are shown in figure-1 : public void setTemp (double newTemp)
public void setWindSpeed
(double newWindSpeed)
public void display (DisplayArea da);
_______________________

Class: News Report


Extends: Report
Attributes:
Details not important at this time
Operations:
Details not important at this time
_______________________

Class: Temperature Gauge


Extends: none
Figure - 1 Attributes:
protected double tempInCelsius;
Class: News Window ; Operations:
Extends: none public double getTempInCelsius()
Attributes: public double getTempInFahrenheit();
protected Display Area da ______________________
protected Report Generator rg
Operations: Class: Wind Speed Gauge
public void display Weather (bool inMetric) Extends: none
public void setReportGenerator Attributes:
(Report Generator newRG) protected double speedInKPH
Operations:
_______________________ public double getSpeedInKPH()
public double getSpeedInMPH()
Class: Report _________________________
Extends: none
Attributes: Class: Display Area
none Extends: none
Operations: Attributes:
public void display (Display Area da) Details not important at this time
________________________ Operations:
Details not important at this time
Class: Report Generator
IV.CONCLUSION
Extends: none
Attributes: By using formalizing the structure of class in UML, we
protected Temperature Gauge tg could model a system as a class diagram in order to
protected Wind Speed Gauge wg determine all the relationships in the system clearly.
Operations:
public Report generateWeatherReport(bool inMetric)

526
Also, we have shown the procedure of formalizing the
system and all the relations in the system by presenting a
Case Study.
We come to these results that formal method is one of
the important and efficient methods for analyzing systems,
by using this method we can model one system easily.
In the future we will attempt to analyze the other
structures of UML and also we will attempt to present one
Debugger algorithms for modeling UML.
Also, formal method helps systems to have a good
responsibility for testing, validating and evaluating.

REFERENCES
[1] http://searchsoa.techtarget.com/definition/class-diagram
[2] Daniela Berardi, Diego Calvanese, and Giuseppe De Giacomo.
“Reasoning on UML Class Diagrams using Description Logic Based
Systems”. Proc. of the KI'2001 Workshop on Applications of
Description Logics. Volume 44 of CEUR Electronic Workshop
Proceedings,2001.

527

View publication stats

You might also like