Visualization of Software Metrics for UML Structural

0 downloads 0 Views 491KB Size Report
to good quality of the software from coding, but now using the design metrics we calculate the .... manners depending on their states we need the state chart.
International Journal of Modern Electronics and Communication Engineering (IJMECE) Volume No. - 6, Issue No.–3, May, 2018

ISSN: 2321-2152

Visualization of Software Metrics for UML Structural and Behavioral Diagrams using Metrics Tool Er. Daljeet Singh

Dr. Harmaninder Jit Singh Sidhu

Department of Computer Science and Engineering Guru Nanak Dev Engineering College Ludhiana, Punjab, India E-mail: [email protected]

Department of Computer Applications Desh Bhagat University

Mandi Gobindghar, Punjab, India E-mail: [email protected]

Abstract: In this paper, we have propose an efficient way to calculate the software metrics of structural and behavioural diagrams of unified modeling language (UML) with the help SD Metrics as a tool. This method is applied to measure the internal quality of attributes and functions of structural and behavioural diagrams of unified modeling language (UML). The SD metrics tool collect the information after parsing the XMI format generated from UML compiler of structural and behavioural UML diagrams. The object oriented design made by structural and behavioural diagrams holds the important part of designing in development process of the software. Early the measurement of metrics will leads to good quality of the software from coding, but now using the design metrics we calculate the cohesion, coupling and other metrics with easy and effectively with the less efforts. Keywords: UML diagrams, object oriented design, metrics, structural and behavioural diagrams, model driven metrics, sequence diagram.

I.

INTRODUCTION

The Unified Modeling Language (UML) is a representation asa graphical view of a model for a system which partial signifies the design and implementation of software to be developed by the software team. The UML diagrams contain the elements: The UML nodes that were connected with edges and also known as paths to the different objects or modules. The UML model might also contain the different documentation like use-cases. The diagram is basically defined by the graphical symbols which were represented on the various UML diagram. A diagram where the contents area are classes with all attributes well as functions of class diagram[4].

the behaviors of the classifiers permitted in the various structure diagrams.

Figure 1 UML Diagrams A diagram which represents the use of classes is “class diagram”. A diagram which represents the sequence of message exchanges between the objects is called “sequence diagram”. In figure 1 list of structural and behavioral diagrams are represented. The structural view is represented by the UML diagrams show the static structure of the full system and its parts of different abstraction and implementation of the system and shows us how they are related with one another. The elements in a structure diagrams represent the valuable concepts of a system, and which may include implementation concepts as well, abstract and real world also. The structure diagrams are not consuming time related concepts it do not show the details of dynamic behavior of the scenarios. However, they may represent the relationships to RES Publication © 2012 www.ijmece.org

Figure 2 Flow chart In the figure 2 the flow cart is represented, in which the flow of our work is displayed. First of all the UML diagrams are created according to the requirement of the user with help of UML compiler like Agro UML, Plant UML, etc. Secondly XMI code is generated with the help of UML compiler and then the XMI code is taken as input for the SD Metrics Tool at the last various attributes and operations of the diagrams were evaluated and calculate the cohesion and coupling and other metrics.

Page| 25

International Journal of Modern Electronics and Communication Engineering (IJMECE) Volume No. - 6, Issue No.–3, May, 2018

II.

EXAMPLE OF VARIOUS UML DIAGRMS

Table 2: Metrics values for XML code of Class diagram Name untitledModel.Bank untitledModel.Customer

A. UML Class diagram The UML class diagram in figure 3 is the example for the banking system with various attributes and functions in which representation of main part of the building block for objects oriented modeling [6]. The UML Class diagram is used for both general as well as conceptual modeling for the development of the applications and also for the detailed modeling the models into the XMI code this can also be used for data modeling. The classes used in class diagram signify the main elements, interaction in the application. In this example the class diagram for the banking system is represented with the required attributes and functions with their associations.

ISSN: 2321-2152

untitledModel.Teller untitledModel.Account untitledModel.Loan

NumAttr 4

NumOps 0

NumPubOps 0

NumAssEl_ssc 2

NumAssEl_sb 2

5 2 2 4

7 6 0 0

6 6 0 0

4 2 1 1

4 2 1 1

from SD Metrics Tool In table 3, the degree of coupling is calculated for each class of UML class diagram with the help of table 2 in which the values generated from the SD Metrics Tool [1]. The class A corresponding to the class bank, class B corresponding to customer class, class C corresponding to teller class, class D corresponding to account class and class E corresponding to loan class. The coupling is the degree of interdependence between the software modules, a measure of how closely is connected two routines or modules are, the strength of the relationships between modules. Table 3 Degree of coupling class diagram Name

A B C D E Figure 3 UML class diagram

In table 1, the list of metrics for the class diagrams is calculated [3] after the compilation of XML code for the class diagram as in figure 3 as generated from Agro UML. Table 1: The metrics for class diagram from SD Metrics Tool The NumAttr The NumOps The Num Pub Ops The Num Ass El ssc The Num Ass Elsb The Num Ass Elnsb

number of attributes in the specific class diagram. number of operations in a specific class diagram. number of public operations in a specific class diagram. number of associated elements in the same scope (namespace) as for the specific class diagram. number of associated elements in the same scope branch as for the specific class diagram. number of associated elements not in the similar scope branch as for the specific class diagram.

In table2, the detailed metrics values for XML code of Class diagram exported from Agro UML as generated from SD Metrics Tool. Which includes number of attributes, number of operations, number of Public operations, number of associations, number of associated elements and number of associated elements not in the scope branch s class in SD Metrics [3].

RES Publication © 2012 www.ijmece.org

Num. of Attributes used/ Total num. of attributes 4/16 5/16 2/16 2/16 4/16

Degree of Coupling

0.25 0.31 0.125 0.125 0.25

In table 4, the degree of cohesion is calculated for each class of UML class diagram with the help of table 2 in which the values generated from the SD Metrics Tool. The class A corresponding to the class Bank, class B corresponding to customer class, Class C corresponding to teller class, class D corresponding to account class and class E corresponding to loan class [1]. The cohesion is basiclly refers to the degree to which the elements inside a module belong to each other. Thus, cohesion measures the interaction between the pieces of functionality within a given module. So, in the highly cohesive systems functionality is strongly related to each other. 4 Degree of Cohesion in class diagram Name A B C D E

Num. of Operations used/ Total num. of operations. 0/13 7/13 6/13 0/13 0/13

Degree of Cohesion 0 0.53 0.46 0 0

B. UML State Chart Diagram The objects have two thing behavior and state but the developers can have difficult to understand them. To understand the complex class better way those act in different manners depending on their states we need the state chart diagrams [1]. In figure 4 the state chart diagram for the banking system is represented with the required states needed for the state chart diagram.

Page| 26

International Journal of Modern Electronics and Communication Engineering (IJMECE) Volume No. - 6, Issue No.–3, May, 2018

ISSN: 2321-2152

be tested at least once and that drives the test. The complexity of state chart diagram is computed by the equation 1:

(1) I= 9/10+0 I= 0.90 C. UML Sequence diagram The UML sequence diagrams represent how the objects interact with each other in specific situations. The important significance of the sequence diagram is that the time passes from top to bottom and interaction which starts from near the top of the diagram and then ends at the bottom. The life line is the element to which represents an individual participant of the interaction. In figure 5, Sequence Diagram for the banking system is represented with the required objects and their lifeline.

Figure 4 UML state chart diagram In table 5, the list of metrics for the state cart diagrams is calculated after the compilation of XML code for the state chart diagram as represented in figure 4, which is generated from Agro UML [3]. Table 5 Metrics for the state chart diagram The trans The teffects The tguard The ttrigger The states The sactivity

number of transitions in the specific state machine. number of transitions with effect in the specific state machine diagram. number of transitions with a guard in the specific state machine diagram. number of triggers of the transitions of the specific state machine diagram. number of states in the specific state machine diagram. number of activities defined for the states of diagram.

In table 6, the detailed metrics values for XML code of state chart diagram exported from Agro UML as generated with the help of SD Metrics Tool. Which includes the number of transitions in the specific state machine, the number of transitions with an effect in the specific state machine, the number of transitions with a guard in the specific state machine, the number of states in the specific state machine, number of activities defined for the states of the specific state machine [3]. Table 6 Metrics values for XML code of State chart diagram from SD Metrics Tool Name Untitled Model.

Trans

TAction

TGuard

TTrigger

States

10

0

0

5

9

The various connecting lines of a specific state diagram represent the interaction from one state to another state. The state can have any number of successor states with in diagram. The more interactions there are, the higher the complexity of the state transition graph is. Actually we are measuring the relation of edges to nodes in a graph. The only here the nodes are not statements, but the states and the edges are not branches but interaction transitions. The design goal is to have as few transitions as possible since every state transition has to RES Publication © 2012 www.ijmece.org

Figure 5 UML sequence diagram Followings are the three metrics for the sequence diagrams to be calculated to measure the performance of sequence diagram [3].

A. The number of “self” messages of sequence diagram The first metric, which actually defines the counts of the number of messages that basically start and end at the same lifeline of sequence diagram. These are messages that objects send to themselves in sequence diagram. The main focus of SAction sequence diagrams should be on object interactions for the sequence diagram. A sequence diagram with a more number of 0 “self” messages may signify that the modeler attempted in the sequence diagram.

B. The height of sequence diagram This metric is well define measures of the “height” of a sequence diagram in terms of the highest number of messages on any of its lifelines. The purposed idea is that very long and “busy” lifelines with lots of messages going inputs and outputs may indicate the objects that have many responsibilities. To tackle the measurement problem, count the number of messages each lifeline of sequence diagram sends or receives. Page| 27

International Journal of Modern Electronics and Communication Engineering (IJMECE) Volume No. - 6, Issue No.–3, May, 2018

SD Metrics standard package of metrics already defines as send messages and receive messages. Which contain the package of various outgoing and incoming messages of the lifeline of sequence diagram, respectively. All the left is to add the number of elements in those sets of sequence diagram.

C. The nesting depth of combined fragments of sequence diagram The combined fragments in the sequence diagrams can be nested. We could have a critical fragment or package that includes, between the other things, an alternative which in turn contains a loop in sequence diagram. This is similar to the nesting of the modules, the functions, the loops, the conditions, and so on in simple programming languages. As in simple programming, more nesting of combined fragments makes the sequence diagrams difficult to read and understand. So, such diagrams are candidates for refactoring, then extract some of the combined fragments into diagrams of their own, and reference them via UML interaction uses in sequence diagram. The complexity of sequence diagram is computed by the equation 2:

(2) I= 2/3+3 I=2/6 I=0.33 III.

CONCLUSION AND FUTURE SCOPE

All the required issues must to be visualize before to develop the software, so that the software metrics having more importance in these days. We have purposed a new technique to calculate the metrics by combining two software the UML compiler is used to build the structural and behavioral diagrams and SD metrics tool is used to evaluate the metrics. For making the software to be s successful we need to conclude it in prior stage. In future we can perform this sequence of steps on various other diagrams and we can also evaluate different metrics by using the program slicing techniques.

REFERENCES [1]

Sxsena vipin. Kumar and Santosh, “Impact of coupling and cohesion in object oriented technology,” Journal of software engineering and pplications, vol. 5, pp. 671-676, 2012.

RES Publication © 2012 www.ijmece.org

ISSN: 2321-2152

[2]

Kambow Lavleen and Singh Daljeet, “Visualizing the software metrics of state chart diagram using program slicing,” International journal of applied information system (IJAIS), ISSN: 2249-0868, foundation of computer science, New York, USA, Vol. 2, pp. 9, www.ijis.org, 2013.

[3]

www.sdmetrics.com.

[4]

Rani Tincy, Sanyal Manish and Garg Sushil, “Measuring Software Design Class Metrics:- A Tool Approach,” International journal of engineering research & technology (IJERT), ISSN: 2278-0181, vol. 1, Issue 7, September 2012.

[5]

Virtual Machinery, "Object-Oriented Software Metrics Introduction and overview", Virtual Machinery Website, http://www.virtualmachinery.com/jhawkmetrics.htm

[6]

KumarAkhilesh and Kaur sunnit khalsa, “ Determining cohesion and coupling for class diagram through slicing techniques”, IJACE, Vol. 4, No..1,pp. 19-24, Jan-June 2012.

[7]

Singh Daljeet and Kamra Amit, “ Measuring Software design metrics of UML Struictural and Behaviourl Diagrms,” Internationl Journal of computer & Mathematicl Sciences (IJCMS), ISSN : 2347-8527, Vol. 6, Issue.5, May 2017.

[8]

Genero, M. ,“ Defining and validating metrics for conceptual models,” [Ph.D. thesis]. University of Castilla-La Mancha, 2002.

[9]

Weyuker, E., “Evaluating software complexity measures,” IEEE Transactions on Software Engineering, 14(9), pp.1357-1365, 1998.

[10] Chidamber Shyam, “A metrics suite for object oriented design”,

IEEE Transactions on Software Engineering, June, 1994. [11] Seyyed Mohsen, “Object Oriented Metrics”, Sharif University of

Technology, International journal of science and research, Department of Computer Engineering, January, 2006. [12] Mythili Thirugnanam, “Quality Metrics Tool for Object

Oriented Programming”, International Journal of computer theory and engineering, vol. 2, No. 5, October, 2010. [13] Preety Verma, “Effect of different UML diagrams to evaluate

the size metrics for different software projects”, Global journal of computer science and technology software and engineering, vol. 15, issue. 8, version 1.0, February. 2015. [14] Ana Nicolaescu, “Evolution of Object Oriented Coupling

Metrics: A Sampling of 25 Years of Research,” RWTH Aachen Univ., Aachen, Germany Horst Lichter ; Yi Xu, May, 2015, pp. 16-18. [15] Alshammari, “A Hierarchical Security Assessment Model for

Object-Oriented Programs,” Fac. of Science & Technol., Queensland Univ. of Technol., Brisbane, QLD, Australia, Colin Fidge, Diane Corney, July, 2011, pp. 13-14.

Page| 28

Suggest Documents