Metric Approach to Anticipate Reusability of Object-Oriented (O-O) Software Systems

In order to meet the fast software evolution, there is a call for the work on software development based process by reducing time as well as efforts. The aim of the development process should not only be developing software products and services but also focus on improving the quality of the particular software. Software Reusability can be considered as one of the solutions to achieve both objectives i.e. productivity as well as quality. There has been an evolution of various methods and techniques related to construction of reusable components over many years. Object-oriented approach also assures increased software reusability. It is easier to reuse object-oriented software rather than conventional software. The notion of reusability related to Object-oriented software can be achieved through inheritance which in turn contributes to development of reusable components. In this paper different metrics related to software reusability of Object-oriented software systems has been summarized and evaluated using Python. Three python-based programs are considered as datasets for this study-the first dataset depicts single-level inheritance, the second dataset depicts hierarchical inheritance whereas the third dataset depicts multilevel inheritance. This study shows more impact of multilevel inheritance on the reusability of Object-oriented software systems and also helped to understand the important role of metrics in evaluation of object-oriented systems.


Introduction
Software Reusability is a prominent way [2] to find out those artifacts [4] from existing components for constructing new systems. According to [5], software reusability is characteristic of a software component that illustrates software's capability of reuse [5].Software reusability also indicates the reuse capability of software component [7].It means that [7] if reusability of software component is low, then it is less reusable component.
According to [14], software reusability means the use of previously written software [14] in form of design as well as code. This method has been already observed widely during development process of most of the software projects. One of the important advantages of software reusability is that it helps significantly to reduce the number of bugs in the particular software [14].
Components can be looked upon as independent as well replaceable factor [10] of the particular application which implements clear and specific function [6]. Reusability is likely a portion of code which can be reused in order to enumerate some advanced functionalities [10].Subroutines as well as functions can be treated as elementary forms of reusability. Reusability is a way to develop larger things [4] from smaller portions and to find out similarities among these portions. Many industrial observers even suggested that up to 20% of development costs can be saved by using reuse approach [7].Software companies that entwine object technology has started using their own constructed reuse strategies by which reuse of software components is monitored as well as analyzed [9].
Object-Oriented techniques are helping out to construct software even in component form [2] and also contributing towards software reuse. There is a high demand for Object-Oriented principles that would in turn provide an effective approach to improve level of software reusability [11].The assessment of software reuse can help developers to explore various reuse levels so as to develop good quality software that can be reused easily as well as effectively. They provide quantitative view [16] of the implementation of object-oriented designs so as to contribute in improving the quality of the software.
This study attempts to use Object-Oriented (O-O) metrics as a predictor of the quality for the primitive system. This study calculates as well as analyzes object-oriented metrics on three Python-based programs. The remaining paper is structured as: Section 2 discusses Software Reusability. Section 3 discusses CK metrics and Section 4 about various literature studies related to usage of metrics for software reusability. Section 5 discusses the case study on estimating the reusability of Object-Oriented (O-O) software by making use of different metrics and Section 6 summarizes the case study analysis. Finally, Section 7 includes the conclusion part.

Software Reusability
Software Reusability means to alter software system [5] with the help of existing reusable components rather than constructing a brand new system. Since these reusable components have been rigorously tested and even verified [20], so they can contribute in improving the quality of particular software. Reusability contributes to increased productivity and better software quality. It not only depends upon code but also covers other software development process assets such as software components [11], test suites [11] documentations [11] and designs [11].The various crisis related to reuse are [16]: ▪ Ineffective Software [16] ▪ Poor quality Software [16] ▪ Incompetent Software [16] ▪ Uncontrollable Project [16] Fig.1 depicting Reusability Process encompasses the following steps: 2.1 Identifying Software Components: In this step, Software Repository is looked over to search for different software components [6].

Context Understanding [6]:
In this step, software programs are interpreted with the help of design patterns by considering existing documentation.

Integrating and evaluating [6]:
In this step, approaches such as Code cloning [6], Code Invocation [6] and COTS (Ramamoorthy C. V 1988) are combined and even their accuracy is also assessed. Some of the advantages provided by Reusability are [16]: ▪ Decreases development cost ▪ Improves Reliability ▪ Market Time is decreased ▪ Maintenance cost reduces [ 16] ▪ Reduces Software Process Risks ▪ Standards Compliance [11] Research Article Vol.12 No.6 (2021), 2456-2467

WMC (Weighted Methods per Class)
It helps to measure the complexities of a particular class. It is defined as the sum total of complexities of all methods of an individual class [15]. It is a direct predictor of time and efforts required to maintain an individual class. More methods in a class limit the probability of reuse [15].Suppose there is a Class F1, with different methods such as m 1 ...m k which are defined in the above class. Let C 1 ...C k be the complexity of the defined methods. If the complexities of various defined methods are considered to be unity, then WMC would be n i.e. the number of defined methods [15].

NOC (Number of Children)
It defines the number of children associated with an individual class [5]. Scope for reuse can be possible if NOC represents a moderate value. NOC helps to assess efficiency as well as reusability. NOC value of a particular class should reflect all the subclasses that share the properties of that particular class.

DIT (Depth of Inheritance Tree of a Class)
It represents the maximum length from root class to current class. Deeper the class in the tree inherits more classes due to more number of methods present in that particular class. Reusability increases with deeper trees.

CBO (Coupling between Objects)
It is the count of the number of classes to which an individual class is coupled [13].Any 2 classes are coupled to each other when a method of one class [13] use other's class methods. High coupling indicates increased reusability.
Where [10]: D: an object, k: number of different objects. Ei: 1 if particular object E is coupled to an object D, 0 otherwise

RFC (Response for a Class)
It represents the methods that are executed potentially [15] in counter to the received message [14] by an object of that particular class [14].
Where [14]: Mi: all methods in the class {Ri}: set of methods called by Mi

LCOM (Lack of Cohesion in Methods) [8]
It represents the methods of the particular class that refers to any given instance variable [8].
Where [15]: G: the number of different pairs of various methods that do not share instance variable of the particular class H: the number of different pairs of various methods that share instance variables of that particular class Cohesion plays an important role in measuring the quality of Object-Oriented systems. This paper analyses the software to find out those classes consisting of unrelated member functions [16] and even covers the code problem concept.
Padhy N., Singh R., Satapathy (2018) developed a model that employs object-oriented metrics such as CK metrics to predict the level of reusability. They analyzed that Object Oriented (OO) metrics [22] especially complexity as well as coupling metrics [22] were much useful for examining software reusability.
Maheswari G., Chitra K. (2019) compared proposed metrics Metric 1, Metric 2 and Metric 3 which were a combination of various object-oriented metrics and analyzed them to find out reusability level of software components.

Data Set[12]
Programs constructed using Python are taken into consideration for this case study. First Dataset depicts "Single-level inheritance " means that [4] when a particular class is allowed to inherit properties from a single class only [3].Second Dataset depicts "hierarchical inheritance" means that [4] properties of one class are inherited by multiple classes [4] whereas third dataset depicts "multilevel inheritance" means that [4] a particular class has been derived from other derived class [5].All these programs are analyzed for their utilization of different object-oriented features during design stage [7].

Metrics Used
In this study class level metrics are used.

Data Selection Method
Semi-automated strategy was used to calculate metrics for this particular study. Proper details of selected classes with their attributes as well as the methods were used as input and on this input basis, various metrics were calculated.
In Object-oriented approach, early effort during software project life cycle is needed in order to find out classes and related objects, encapsulation [8], polymorphism [8] as well as inheritance [8].Much effort would be saved instead of rewriting code [9] that would in turn helps in producing high quality software [9].

Object-Oriented Design [10]
An object-oriented system [11] begins with class definition containing related attributes as well as methods [11].Objects can be created from a template known as class. These objects share common design and behavior demonstrated by various methods. The operation that is defined inside class declaration scope is defined as method. Three imaginary object-oriented designs [10] for python-based programs are depicted in appendix

Analysis And Discussion
In this section the dataset used for the particular study has been discussed. The results are analyzed [11] as well as evaluated with the help of graphs. To implement the study three programs written in Python has been used. () and print_event ().Class Manager has ID and Name as its attributes. The Manager class inherited print_event () method from its parent class Event and even contains its own methods such as def_init_Manager () and print_aud ().

Dataset 2: Tax_Details Program has been used for depicting Hierarchical inheritance that consists of Parent class Tax and
Two Child classes DirectTax and IndirectTax.Class Tax has Status as its attribute. The methods used by Tax class are def_init () and print_tax (). Class DirectTax has Amount, Rate and Exemption as its attributes. DirectTax class inherited print_tax () method from its parent class Tax and even consists of its own methods such as def_init _amount (), def_init _rate (), calc_total ().Class IndirectTax has Income, InterestRate and Deduction as its attributes. The IndirectTax class inherited print_tax () method from its parent class Tax and even contains its own methods such as def_init_idt (), total_inc (), print_ir () and calc_total ().

Dataset 3:
Dictionary Program has been used for depicting multilevel inheritance that consists of Parent class Dictionary, Child class WordCount and Grand Child class Vocab. Class Dictionary has Terms as its attribute. The methods used by Dictionary class are def_init_ter () and print_dic (). Class WordCount has Words and Word_mean as its attributes. WordCount class inherited print_dic () method from base class Dictionary and even consists of its own methods such as def_init _wc (), print_wc () and len ().Class Vocab has Text, Text_wc and Text_mean as its attributes. The Vocab class inherited len () method from child class WordCount and even contains its own methods such as def_init_vb (), set (), print_wc () and print_vocab ().
The metrics used in above case study gives insight of how different classes are dependent on each other [15].High degree inheritance [3] adversely affect the health of software system whereas low degree inheritance do not support object-oriented concepts [6].It is much easier to reuse more independent class in another application [8].

Evaluation Results
: Table 1 provides the values for different such as metrics WMC, NOC, DIT, RFC, CBO and LCOM [13] for Event program considered for the study [11]. In the above Table 1. : DIT= Depth of Inheritance Tree [13], NOC=Number of Children [13], CBO=Coupling between Objects [13], LCOM=Lack of Cohesion in Methods [13], WMC=Weighted Methods per Class [13], RFC=Response for a Class [13]. Fig.2 represents graph for metrics used in Event Program Figure 2.Graph for metrics-Event program (Source: Self) Table 2 provides the values for different metrics such as WMC, NOC, DIT, RFC, CBO and LCOM [13] for Tax_Details program considered for the study [11].

Research Article
Vol. 12 No.6 (2021), 2456-2467 In the above Table 2. : DIT= Depth of Inheritance Tree [13], NOC=Number of Children [13], CBO=Coupling between Objects [13], LCOM=Lack of Cohesion in Methods [13], WMC=Weighted Methods per Class [13], RFC=Response for a Class [13]. Fig.3 represents graph for metrics used in Tax_Details Program Figure 3. Graph for metrics-Tax_Details program (Source: Self) Table 3 provides the values for different metrics such as WMC, NOC, DIT, RFC, CBO and LCOM [13] for Dictionary program considered for the study [11]. In the above Table 3. : DIT= Depth of Inheritance Tree [13], NOC=Number of Children [13], CBO=Coupling between Objects [13], LCOM=Lack of Cohesion in Methods [13], WMC=Weighted Methods per Class [13], RFC=Response for a Class [13]. Fig.4 represents graph for metrics used in Dictionary Program  Table 4 provides the values for different metrics such as WMC, NOC, DIT, RFC, CBO and LCOM [13] for average of all the classes of three programs (Event Program, Tax_Details program and Dictionary Program) considered in this above study. In the above Table 4. : DIT= Depth of Inheritance Tree [13], NOC=Number of Children [13], CBO=Coupling between Objects [13], LCOM=Lack of Cohesion in Methods [13], WMC=Weighted Methods per Class [13], RFC=Response for a Class [13]. Fig.5 represents graph for Average of classes of different programs used in this case study. The value of metrics used above in all programs indicates that in all programs, there is a moderate use of inheritance. Figure  5 depicts that WMC, NOC, DIT, CBO and RFC has larger values for Dictionary Program than Event program and Tax_Details program. So, Dictionary Program depicting multilevel inheritance [9] is more reusable than other two programs (Event Program and Tax_Details Program).

Conclusion And Future Work
In this paper, metrics used are being analyzed and measured for three Python programs (Event, Tax_Details and Dictionary). These metrics helped to figure out the features related to object-oriented software system. One of the result of this study was that different datasets that were used for the above study showed good utilization of object-oriented (O-O) features [11].It was also concluded that reusability is more impacted by multilevel inheritance. This study [11] also helps to understand that metrics plays an important role in evaluation of object-oriented software systems.
The future study would propose more metrics and would also analyze their impact on object-oriented systems.