Keywords

1 Introduction

Object-oriented development has proved its value for systems that must be maintained, reused, and modified. Coupling has been defined as one of the most important qualitative attributes to measure the performance of software at design or implementation phase [1]. Coupling can be categorized into three types: component coupling, interaction coupling, and inheritance coupling. This research is mainly focused on interaction couplings such as MPC, RFC, and MIC. Interaction coupling occurs when the methods of a class invoke methods of another class. In this, the main thing that is to be understood is about message. A message is a request that an object makes of another object to perform an operation [2]. The operation executed as a result of receiving a message is called a method.

The rest of the paper is organized as follows. Section 2 summarizes about the metrics used in the previous papers. Section 3 highlights about the problem with existing coupling parameters. Section 4 highlights the types of interaction coupling, and Sect. 5 depicts the framework. Section 6 summarizes a new algorithm design to measure those coupling parameters. Sections 7 and 8 offer the results and the conclusion.

2 Literature Survey

Li and Henry [3] identified a number of metrics that can predict the maintainability of a design. They define message-passing coupling (MPC), defined as the number of send statements defined in a class. The number of send statements that are sent out from a class may indicate how dependent the implementation of the local methods is on the methods in other classes. MPC only counts invocations of methods of other classes, not its own. Chidamber and Kemerer [2] proposed and validated a set of six software metrics for object-oriented systems, including two measures for coupling RFC and CBO. The response set (RS) of a class is a set of methods that can potentially be executed in response to a message received by an object of that class. A given method is counted only once. RFC includes methods called from outside the class and also a measure of the communication between that class and other classes. Vijaya Saradhi and Sastry [4] proposed a unique new approach for metric, which delivers the system quality based on cohesion and coupling between classes. The proposed metric shows the relationship between the classes based on the flow in control and the number of occurrences of class, which is mainly based on the existing systems’ input. Arisholm et al. [5] stated that the relationships between coupling and external quality factors of object-oriented software have been studied extensively for the past few years. The authors concluded about the empirical relationships between class-level coupling, class fault- proneness and to measure coupling is through structural properties and static code analysis.

3 Problem Specifications

The current research on modeling and measuring the relationships between object-oriented programs through coupling analysis is insufficient. Coupling measures are incomplete in their precision of definition and quantitative computation. Moreover, some existing coupling measures do not reflect the differences in and the connections between design-level relationships and implementation-level connections. Hence, the way the coupling is used to solve problems is not satisfactory. Measuring various types of coupling manually is not possible, and tools fail to measure some important coupling parameters.

4 Proposed Metrics

Different types of coupling have evolved over time. But single type of coupling is inadequate to reduce the complexity of the code. This paper compared various couplings and finally selected the best coupling parameters to evaluate the complexity, quality factor, and reliability of object-oriented program [6]. We propose three metrics MPC, RFC, and MIC that help to detect the reusability and efficiency in design of object-oriented programs at the early stage.

4.1 Message-Passing Coupling

MPC is the count of total number of functions and procedure calls made to external units [3]. The MPC measures the dependency of local methods to methods implemented by other classes.

Viewpoints: This allows for conclusions on reusability, maintenance, and testing effort [7]. Message passing is calculated at the class level.

$$ {\text{MPC}} = \sum\limits_{j = 1}^{n} {{\text{MC}}_{e} } $$
(1)

where MC e is method call to external class and j is the number of classes.

4.2 Method Invocation Coupling

It is defined as the relative number of classes that receive the message from the particular class [8].

Viewpoints: The number of methods invoked implies the program reliability and efficiency [9]. The methods invoked should be minimum so as to maintain the system throughput.

$$ {\text{MIC}} = \sum\limits_{j = 1}^{n} {{\text{MI}}_{i} } $$
(2)

where MI i is method invoked from other classes and j is the number of classes.

4.3 Response for Class

RFC is the number of functions and procedures that can be potentially be executed in a class. Specifically, RFC is the number of operations directly invoked by member operations in a class plus the number of operations themselves [2].

Viewpoints: If the larger number of methods can be invoked in response to a message, the testing and debugging of class becomes more complicated [10].

$$ {\text{RFC}} = \sum\limits_{j = 1}^{n} {{\text{MC}}_{e} + {\text{MC}}_{I} } $$
(3)

where MC e is method call to external class, MC I is methods of its own class, and j is the number of classes.

5 Framework of the Proposed System

The proposed framework is named as interaction coupling extractor (ICE), which is depicted in Fig. 1.

Fig. 1
figure 1

Interaction coupling extractor

The framework has been partitioned into three phases. Each phase will perform some unique and important tasks.

5.1 Input Phase

This is the initial phase which is used to get input from the user. Programmer should give the jar file as input. Java ARchive (JAR) file is a collection of text, images, packages, and class files of java. A JAR file is essentially a zip file that contains an optional META-INF directory. But jar file cannot be measured directly. It must be extracted into individual class files. Jar files of variable size are given as input to interaction coupling extractor.

5.2 Processing Phase

This is the second level of extraction. Once a jar file is accepted, the file will be sent to interaction coupling extractor engine where the engine will separate the jar file into individual class files. That class files will be loaded into class loader in order to evaluate the interaction coupling parameters (RFC, MPC, and MIC).

5.3 Result Phase

The measured class will be displayed in the text file, which shows the number of RFC, MIC, and MPC measures of individual class. Then, the results are analyzed.

6 Algorithm Design

This design algorithm shows how to design the interaction coupling parameters MPC, RFC, and MIC and also shows how to measure those parameters.

7 Results

Two jar files, namely JavaSCV and JEdit, are given as input to interaction coupling extractor (ICE), and the results are shown below.

File Name::

JavaCSV.jar

Size::

14.0 Kb

Source::

findjar.com/jar/net/sourceforge/javacsv/javacsv/2.0/javacsv-2.0.jar.htm

Number of classes::

12

From Table 1, it is clearly shown that the RFC and MPC for class com.csvreader.CsvReader are higher. Hence, that class must be reprogrammed in order to make the jar file efficient.

Table 1 Results of JavaCSV.jar
File Name::

JEdit.jar

Size::

114 K

Source::

http://www.java2s.com/Code/Jar/j/Downloadjeditsyntaxjar.htm

Number of classes::

46

From Table 2, it is clearly shown that the RFC and MPC for class installer.SwingInstall are higher. MIC of installer.OperatingSystem class is high. Hence, both the classes must be reprogrammed in order to make the jar file efficient.

Table 2 Results of JEdit.jar

Other jar files, namely JUnit.jar, HSQL.jar, with more than 200 class files, are given as input, and the results are analyzed. The efficiencies of all the classes are measured. Maintainability of the program is improved based on the measurements. The classes that exceed the maximum ranges must be reprogrammed in order to make the program efficient, to reduce complexity, and to make it more flexible.

8 Conclusion and Future Scope

This paper introduced a framework for interaction coupling for object-oriented systems. The interaction coupling is best suited to find the reusability and efficiency of the object-oriented systems. The algorithm used to implement the concept of RFC, MPC, and MIC is easy to understand. The detailed result sets show how the coupling parameters are measured and evaluated. The future work is to measure the component and inheritance coupling. The component coupling show how the arguments passed from one method to another method are measured. Inheritance coupling is used to measure the coupling between the inherited classes. The proposed framework will measure both types of coupling, and the measured parameters are displayed as chart.