Tuesday, November 12, 2019

Enhancement in MOOD metrics

 The original MOOD metrics provided MHF and AHF to measure the level of encapsulation in the system. It was largely related to Information Hiding and it was not associated with other concepts of Encapsulation. Encapsulation and Information Hiding are not synonymous words but rather information hiding is only a part of larger concept encapsulation. Encapsulation can be defined using two words- Privacy and Unity. There can be a tradeoff between these two for the given class. Thus, MHF and AHF are not sufficient to measure the encapsulation for the given software system. In the newly proposed metric, we measure the two terms Privacy and Unity. Privacy can be measured by counting the number of private attributes inside a class. Unity can be measured by cohesion between the methods and attributes of the given class. If the class in a system is having more than around 75% of encapsulation then there is a specific use of encapsulation and there is no requirement to split the class.

 

Measurement of Class Unity (CU)       


       Class Unity measures the similarity between different methods and operations constrained in the class. If two methods are using the same attributes as their instances then these methods are considered as similar methods. The methods form a cluster-like structure where a cluster contains methods that are similar and methods in different clusters are not similar to ro each other. If there is only a single cluster then we can say that all the methods are similar to each other and the class has a high value of Class Unity(CU). Chidamber and Kemerer had introduced a new measure called “Lack of Cohesion in Methods”(LCOM). It measures cohesions by means of considering similar methods that use the same attributes.

For example, there is a class QUEUE wherein there are four attributes element, end, size, and bag. There are four methods Queue, Delete, Insert and Isempty. Now suppose element is used by Queue, Insert and Delete. The end is used by Queue, Delete, Insert, Isempty. Beg is used by Delete and Queue. Size is used by Queue, Delete, Insert. Now in this case Insert is similar to Delete, Isempty and Size. Delete is similar to Isempty, Size and Insert. Size is similar to Insert and Delete. Empty is similar to Insert and Delete. 

Measurement of Data Visibility(DV)


      It is concerned with how the data (Attribute and Methods) of a class is visible or directly accessible to other classes. If the attributes are private then they can not be accessible by other classes. Data Visibility generally uses a scale from 0 to 1 where 0 stands for private that fully hidden and 1 stand for the public. It is measured by the ratio of no. of classes that can access the data to the total number of classes in the system. The data visibility measurement is associated with the AHF metric. The final value of Dv is the average visibility of all the attributes.


Measurement of Encapsulation Factor (EF)


     To measure the level of encapsulation for the given class Encapsulation Factor (EF) metric is used. It considers both the aspects of a class that is attributes and methods. It is a function of both data hiding and cohesion metrics of a class.

         



The values of Class Unity(CU) and Data visibility(DV) ranges from 0 to 1. A class having CU and DV value 1 is considered as having 100% encapsulation. The point (1,1) is represented in the Figure is called optimal point.

Using the values of CU and DV we can measure the encapsulation for a given class. To find the value of the Encapsulation factor we have to find the distance of the given point from the optimal point. The equation for finding the value of EF is given by the following Figure.

        

                    

This value of EF shows the measure of encapsulation in the given class system. Generally, it is desirable to have Ef value close to 1. Let us consider two cases.

Best Case: 

Best case is possible when we have value of Encapsulation Factor as 1. Here the values of both CU and DV will be 1 and the point will be (1,1) which is considered as the optimal point.

Worst Case:

Worst case is possible when the value of EF is 0. Here the values of both CU and DV are 0. So we get point (0,0). This gives the minimum measure of encapsulation for the given class of the system.

Maintainability Estimation Model for Object-oriented software in the design phase


     In the software development life cycle, measuring the maintainability of the system in the early phase such as the design phase can reduce the huge amount of cost which manicured due to errors in the system because we can nullify the effect of it.

There is a model suggested which is helpful in estimating the maintainability of class diagrams of the system. The model is called MEMOOD (Maintainability Estimation Model for Object-Oriented software in the Design phase).

For UML class diagrams we need to understand the size and structural complexity metrics. These metrics are very useful for calculating the modifiability and understandability of the class diagram. 


The Maintainability Estimation Model can be represented by the following figure.




For making the model we have to go through the understating of correlation between these terms- Modifiability, Maintainability, and Understandability. The correlation metrics are defined as below.


  

From this Figure, we can say that Understandability and Modifiability are correlated to Maintainability whereas the correlation between Understandability and Modifiability is not that strong. Now we want to see how Maintainability is dependent on Understandability and Modifiability. We can make a linear model where Maintainability serves as a dependent variable whereas the other two serve as the independent variables. After calculating the values for the model we get out the linear model described by the following equation.



No comments:

Post a Comment