MOOD Factors to Assess a Java Program
In this tutorial, we will comprehendthe meaning of mood factors in Java.
For the development of any software system,the quality of anapplication is important. It is more important to maintain large-scale software. The cost of the software would get reduced and the potential of the software will get enhanced if high-quality software is being used.
For the measurement of the software quality in a more quantitative way, MOOD factors are being.
MOOD is an acronym for Matrices for Object Oriented Design. It defines the features of an object-oriented application or program. This has been developed to enhance the level of java. It is taken into account to estimate a mark of Java program.Here are the six software quality indicators or metrics that are included in MOOD factors:
- Method Hiding Factor (MHF)
- Attribute Hiding Factor (AHF)
- Method Inheritance Factor (MIF)
- Attribute Inheritance Factor (AIF)
- Coupling Factor (COF)
- Polymorphism Factor (POF)
Information Hiding Factors
It includes the first twofactorsi.eMHF and AHF. It is a measure of the usage of the information-hiding notion supported by the encapsulation mechanism. Information hiding is used to:
- Handle the complexities by observing the composite components such as black boxes.
- Decrease "side-effects" triggered by modification of an application.
- Support a top-down method.
- Examine and join the systems.
Method Hiding Factor (MHF)
The following mathematical formula is taken into account to calculate the MHF:
here,
- Mh(Ci) = concealed Methods in class Ci
- Md(Ci) = Mv(Ci) + Mh(Ci): Methods clear in Ci
- Mv(Ci): observable Methods in class Ci
- TC: Total number of Classes
The visible methods examine the functionality of the class. The MHF gets reduced if the overall classfunctionality gets enhanced. To implement this functionality, Atop-down approach is applied to implement this functionality. It means that the class implementation must be a stepwisebreakdown process so thatmore details could be added in hidden methods that result in incremented MHF.
The adequate range of MHF values lies within an interval 2,3 and 4. Too low values denote inadequately abstracted methods whereas higher MHFs denote lesser functionalities.
Attribute Hiding Factors (AHF)
AHF can be calculated by taking into account the following mathematical formula:
here,
- Ah(Ci) = concealed attributes in class Ci
- Ad(Ci) = Av(Ci) + Ah(Ci): attributes well-defined in Ci
- Av(Ci): observable attributes in class Ci
- TC: Overall number of classes
The usage of the information-hidingnotionmaintained by the encapsulation mechanism is measured by AHF. Information hiding letshandling the complexity by converting complex components into black boxes. AHF should be used as much as probable. Preferablywholecharacteristics would be hidden;hence they could only be accessed by the equivalent class methods. The designers' attention should be triggered by very low values of AHF. The complexity of the program and the value of AHF are inversely proportional to each other.
Inheritance Factors
The third and fourth factors i.e MIF and AIF are measures of inheritance.
This mechanism is taken into account to express the similarity among classes allowing for the description of simplification and specialty relations, and an interpretation of the meaning of inheriting another class through reuse.
Method Inheritance Factor (MIF)
MIF can be computed by using the following mathematical formula:
here,
- Mi: inherited methods
- Ma(Ci) = Md(Ci) + Mi(Ci): characteristicswell-defined in Ci
- Md(Ci): well-defined methods
- TC: Overall number of classes
Inheritance is not necessarily used but, the alignment of many inheritance relations together forms a directed acyclic graph, whose thickness and penetration allow easy understanding.
Attribute Inheritance Factor (AIF)
AIF can be computed through the following mathematical formula:
here,
- Ah(Ci) = hidden characteristics in class Ci
- Ad(Ci) = Av(Ci) + Ah(Ci): characteristics defined in Ci
- Av(Ci): visible characteristics in class Ci
- TC: Overall number of classes
Coupling Factor (COF)
It is taken into account to measure the coupling between classes.
COF can be computed by using the below mathematical formula:
here,
is_client(Cc,Cs) =| 1 if (Cc⇒Cs)^(Cc≠Cs) , 0 otherwise
TC: It signifies the entire number of classes.
The client-supplier relation, represented by Cc ⇒ Cs, means that Cc (client class) consists of at least one non-inheritance reference to a characteristic of class Cs (supplier class). The numeratorof COF denotes the actual number of couplings not referable to inheritance 2, 3, 4, and 6.
It is needed that classes interconnect with as few other classes as possible and that they exchange as little data as possible. Coupling relations risecomplications, lessen encapsulation and potential reuse and limit understandability and maintainability. In addition to this, coupling in software systems has a strong negative impact on software quality, and therefore should be kept to thelowest during the design phase. However, the classes must cooperate to carry some kind of functionality for a given application. Hence, the value of COF is expected to be lower bound 2, 3, and 4.
Polymorphism Factor (POF)
By the term Polymorphism, we understand that it is the ability to have so many forms.It is a very important concept in object-oriented programming
here,
- Mo(Ci): overriding Methods in class Ci
- Mn(Ci): new Methods in class Ci
- DC(Ci): quantity of Descendants of Class Ci (derived classes)
- TC: Entireamount of Classes
The numerator of POF signifies the realamount of probable different polymorphic circumstances. Thespecifiednote sent to class Ci can be destined, statistically or dynamically, to a termed method application which may acquire any number of shapes as many times this method gets overridden.