Model and Criteria for the Automated Refactoring of the UML Class Diagrams

Many papers have been written on the challenges of the software refactoring. The question is which refactorings can be applied on the modelling level. Based on the UML model, for example. With the aim of evaluating this possibility the algorithm and the software tool of automated UML class diagram refactoring were introduced. The software tool proposed reduces the level of the UML class diagram complexity metric. Keywords—UML; refactoring; class diagrams; software architecture; software design; UML transformation


INTRODUCTION
MDA (Model Driven Architecture) [1] approach is supported by OMG (Object Management Group).In the MDA approach design process starts with the creation of the PIM (Platform Independent Model).Then the PIM is automatically transformed into the PSM (Platform Specific Model).
MDA proposes standards of model creation, transformation and exchange.For example, UML (Unified Modelling Language) [2] is used to describe models, XMI (XML Metadata Interchange) [3] is used to exchange models between tools.One tool can be used to create a model, and another one to analyze or transform it.Thus, model transformations play an important role in the MDA conception.One of the possible model transformation objectives can be model refactoring.
Refactoring means restructuring of the system without changing its behavior.Originally, refactoring was connected with the code-level transformations.A number of studies have investigated different means of the software refactoring [4,5,6].Some refactorings apply design patterns to the existing code.First design patterns were proposed by Erich Gamma et al. in [7].Software design patterns describe solutions of commonly occurring problems.Design patterns are aimed at the improvement of such software characteristics as modifiability, reusability, maintainability, etc.
Many papers have been written on the challenges of the software refactoring.The question is which refactorings can be applied on the PIM level described with the UML.
There are two main approaches to the problem of UML refactoring.The first one is connected with the search based software engineering [8] (SBSE), which is a topic of growing interest nowadays.In SBSE software engineering problems are formulated as optimization problems, which then are solved by search algorithms (Genetic algorithm, Simulated annealing, Swarm intelligence algorithms, etc.) SBSE is used in order to solve UML class diagram refactoring problem in [9][10][11][12][13][14].However, the result of applying search algorithms to class diagrams sometimes can be meaningless.
The second approach is connected with the developing frameworks of automated model refactoring [15][16][17][18], where the main role is given to the software designer.And the framework applies transformations, using some transformation rules in interaction with the designer.This paper explores the problem of the automated UML class diagram refactoring.This problem is significant as long as the model refactoring is less time-consuming than the code refactoring.Furthermore, model refactoring is connected with the creation of PIM rather than PSM.
The rest of this paper is organized as follows: First, the problem of the automated UML class diagram refactoring is formulated in Section 2. Then an algorithm of the automated UML class diagram refactoring is proposed in Section 3. In Section 4, the software tool UML Refactoring is introduced before concluding in Section 5.

II. FORMULATION OF THE PROBLEM
The scheme of the UML class diagram analysis is shown in  Let  The The analyze (t,d) method is specific for each transformation.For example, the algorithm of searching sets of diagram elements E on which the Strategy transformation can be conducted can be described as follows: 1) Make a list of classes having inheritors l1. 2) 2. For each class from l1 check whether its inheritors implement any interfaces.If yesadd them to the list l2. 3) are weights for each group of elements.

IV. UML CLASS DIAGRAM REFACTORING TOOL
Class diagram refactoring software should solve the following tasks: 1) UML class diagram analysis: searching the transformations which can be conducted to decrease the fitness function value; 2) UML class diagram transformation.Main functional blocks of the UML refactoring tool are shown in Fig. 2. XMI parser translates XMI document to the abstract data structure UML Map [19]   The result of applying the Strategy transformation to the diagram d is shown in Fig. 5 and Fig. 6.Future research should examine the effectiveness of the proposed framework to the large software systems.Furthermore, lists of available transformations and calculated metrics should be expanded.

Fig. 1 .
Algorithm takes as input UML class diagram , d fitness function ) (d f and a set of semantically equivalent transformations T .The output is a list of transformations , * T which reduce fitness function value and are recommended to apply.

Fig. 1 .
Fig. 1.Scheme of the UML class diagram analysis

Fig. 5 .Fig. 6 .
Fig. 5.The result of applying the Strategy transformation to the diagram d After the transformation, the following is attained: , 23 .7 02 .0 08 .0 05 .0 7 02 .0 06 .0 ) ' (         d K .96 .4 ) (    d K , which stores UML class diagram elements in hash-maps.Then Analyzer searches pairs {t,E}, which reduce fitness function value and forms the Transformations table on the screen.OOM Calculator calculates various object-oriented metrics for the UML class diagram and forms the Metrics table on the screen.If a user has chosen some transformation from the table, the Transformer applies it to the diagram.User can export an attained diagram to XMI document.www.ijacsa.thesai.org