Keywords

1 Introduction

Software engineering aims at improving the quality of software products in terms of their internal and external characteristics. Quality of software products and processes can be measured with the help of software metrics. But with the increase in the complexity of software, there was the need of better techniques. Object Oriented Approach (OOA) has evolved as a programming language where problem solutions are framed by decomposing them into objects that integrate functions and data in a single unit [1, 2]. Although OOA has many advantages in modelling constructs for modularity, polymorphism etc., it has some limitations also. In OOP, the implementation of concern is scattered in multiple classes. Such scattered concerns are called crosscutting concerns. Examples of such concerns are logging, synchronization, exception handling etc. [4]. Aspect Oriented technology provides the solution to this problem of crosscutting concerns which remained unsolved in Object oriented and other traditional languages.. Aspect Oriented software development (AOSD) emerged as technology that modularize crosscutting concerns with the introduction of new concept termed as aspect [3].

According to Salamon and Wallace [5], National Institute of Standard and Technology (NIST) provides measurement information for determining the reusability of software. The report prepared by NIST researchers identified ten indirect Quality characteristics for software products based on extensive research in the available literature, which also includes OO technology. The listed characteristics include parameters like- understandability, modularity, portability, reliability, completeness, maintainability, adaptability, flexibility, expandability, efficiency, completeness and generality. As Aspect Oriented Technology is an extension of OO technology and has some new features, some quality parameters needs to be redefined for aspect oriented technology. The important characteristics which contribute in assessment of reusability of AOS cannot be measured directly.

In order to provide solution to the problem Brichau and Hondt [6] proposed a reusability quality model. According to this proposed model, for measuring external quality characteristics internal characteristics such as complexity, cohesion, coupling and size are very helpful. The reusability model established the relationship among external Quality characteristics and internal characteristics by using the metrics for internal characteristics. According to this model reusability is mainly affected by Cohesion, Coupling, Size and SoC.

A high maintainable and quality software system has an advantage of reusing the existing packages, if the cohesion of these packages is maximized. As stated by Vinay and Vandana [7], Package level cohesion measure plays a crucial role in analyzing the reusability, maintainability and understandability of software. Martin et al. [8] in his work had proposed the package cohesion principles to address the goal of package structuring. According to Martin packages must contain classes that can be reused together and that are being affected by the same changes.

In this paper, effort is made to evaluate reusability of AOS using package cohesion measure PCohA, along with other package level metrics effecting reusability. Evaluation is carried out by using Fuzzy logic approach for predicting reusability using package level metrics.

The rest of the paper is organised as: Next section gives the related work done in this field which is followed by the factors affecting reusability. Then the fuzzy logic model for evaluating reusability using internal quality attributes is discussed which is followed by the case study of AspectJ project AJHotdraw for validating proposed model. In the last conclusion and future work is given.

2 Related Work

Nowadays, real world systems are evolving so fast that they are capable to meet challenges among the users and developers. A well modularized designing of software is required to meet the functional and non-functional requirement. AOSD has emerged as the development technology that modularizes the crosscutting concerns to handle the problem of scattering and tangling of concerns. Although AOSD has emerged as a solution for OO problems, but it has its own limitations. The related work will discuss the work done so far by many researchers in the area of OO and AO approach for assessing software reusability.

According to Salamon and Wallace [5], the National Institute of Standards and Technology (NIST) has defined the structural quality of software systems by specifying ten quality characteristics for software products. These quality characteristics are listed as- understandability, modularity, portability, reliability, completeness, maintainability, adaptability, flexibility, expandability, efficiency, correctness, and generality. To measure these indirect quality measures, inter quality attributes are required. According to the report, internal characteristics for assessing reusability and maintainability include - size, complexity, cohesion, coupling etc.

First quality model for AOS was proposed by Kumar et al. [9], known as AOSQUAMO. This model was an improvement of ISO Quality Model [10]. AOSQUAMO includes various external quality attributes like Complexity, Reusability, Modularity and Code-Reducibility. New attribute, evolvability is added to AOSQUAMO by Kumar [11], and the new model was named as AOSQ model. The author added some parameters as sub-characteristics of evolvability like Design Stability, Configurability etc.

Sant’ Anna et al. [12] proposed a framework to assess reusability and maintainability for AOS using internal attributes. Authors had proposed a metrics suite and a quality model for AOS. The authors have concluded that the quality of AOS can be assessed using structural design properties such as coupling, cohesion, and SOC. Leite et al. [13], has worked on enhancing the quality of software in terms of its reusability using goal driven process to. Authors have proposed a method for using quality parameters for calculating software reuse. Cunha et al. [14] had explored the use of quality characteristics like reusability, modularity and understandability for AspectJ along with java programming to enhance the AO development. Zhang et al. [15] had worked on using AOS for designing reusable connectors. Aljassere et al. [16] has proposed a new language ParaAJ, to enhance reusability in AOS by modularizing aspects.

Singh et al. [17], has proposed a model to predict maintainability for AOS using fuzzy logic. They had considered the four main internal quality attributes for assessment: coupling, cohesion, size and SOC. All these metrics are class level metrics. Nerurkar et al. [18] in their work has demonstrated the process of automating the prediction of reusability using external parameters - Understandability, maintainability, adaptability and AOS using fuzzy logic approach by considering internal parameters - cohesion, coupling, Size and SOC. Singh et al. [19], in their another research work had used fuzzy logic for assessing reusability for AOS. They concluded that using fuzzy logic for assessing reusability can help in selecting best quality software. Singh, Sangwan and Srivastava [20]) had also proposed reusability assessment model for AOS using Multi Criteria Decision Making (MCDM) approach. They have validated the proposed model by using Analytic Hierarchy Process (AHP) and cross validated it by applying Fuzzy AHP. Singh and Singhal [21] worked on assessing reusability for component based software system using fuzzy logic approach. They have used various factors like modularity, maintainability etc. for predicting the reusability.

All the frameworks for assessing OOS and AOS quality are defined on the basis of class level metrics. In this paper efforts have been made to assess Reusability, using the fuzzy model approach for AOS using package level metrics. Here, Package level metrics like Package cohesion (PCohA) [22], coupling etc., are used to assess reusability.

3 Factors Affecting Reusability

Package level metrics for reusability is proposed [23] as:

  1. 1.

    ECA (Efferent Coupling in Aspects): This is defined as the number of packages (aspects) on which a package (aspect) depends upon.

  2. 2.

    PCohA (Package level Cohesion in AOS): It is defined as the percentage of number of relations of each class present in the aspect to the number of classes in the aspect, averaged over the total number of classes in the aspect.

  3. 3.

    Aspect Design Size (ADS): This is the total number of classes and interfaces in aspect (Package).

  4. 4.

    Messaging (IP): Messaging can be calculated by counting the interface size of the package. Interface size of the package is the count of public classes in the package.

These metrics are defined on the basis of formula given in Eq. (1):

$$ Reusability = - 0.25*coupling + 0.25*Cohesion + 0.5*Messaging + 0.5*Design\;size $$
((1))

4 Proposed Fuzzy Framework

This section gives the description of fuzzy logic approach for assessing of reusability for AOS.

Fuzzy logic approach for prediction was introduced with the idea of fuzzy set theory by Lotfi Zadeh [25]. It is defined to present the theory of incomplete facts, where the fact value may vary from totally true to totally false [26]. According to Sivanandam et al. [26], the fuzzy model can be implemented with the help of Fuzzy inference system (FIS). FIS works by mapping input variables with output variable using fuzzy set. It consists of four modules - Fuzzification, Inference, Composition and Defuzzification. FIS works through five steps:

  1. 1.

    Fuzzification of the inputs using the membership functions,

  2. 2.

    Constructing Fuzzy Rules for fuzzified inputs,

  3. 3.

    Mapping the input rules with the output membership function, to find the weightage of the rule.

  4. 4.

    Analyzing the results to get predicted value of output.

Input variables are the internal characteristics that are used to assess the output attribute. The output variable is the dependent attribute which is to be predicted after fuzzification of input attributes. For the proposed fuzzy approach, input variables are the internal attributes of software such as cohesion, coupling etc. and the output variable is the external attribute such as Reusability etc. Membership functions are defined for input and output attributes to link their values. Measurement values of all attributes (inputs and outputs) are taken in scale of 0 to 1. To evaluate output variable using input variables in MATLAB, Mamdani fuzzy system is used.

Membership functions links input attributes with output attributes with the help of rules defined on inputs. Rules are constructed in Rule editor, the graphical interface for constructing rules in fuzzy model. The rules are of the form “If’abc’ and/or’xyz’ then’ XYZ’ ”. The rules constructed with the help of rule editor can be viewed through rule viewer. It consists of columns representing input and output variables. If there are n columns in the rule viewer, then last column represents the ‘then’ part of each rule and rest n-1 columns are referring to input variables.

5 Assessing Reusability for AOS Using Fuzzy Approach

5.1 Input and Output Variables for Fuzzy Model

For implementing proposed fuzzy model, input and output variables are required. Here, output variable is quality parameter Reusability for Aspect Oriented system and input variables for assessing Reusability are as follows:

  1. 1.

    Coupling: ECA (Efferent Coupling in Aspects)

  2. 2.

    Cohesion: PCohA (Package level Cohesion in AOSD)

  3. 3.

    Design size: ADS (Aspect Design Size)

  4. 4.

    Messaging: IP (Interface size of Package)

These input variables are mapped with output variables for predicting their effects using MATLAB Mamdani fuzzy system.

5.2 Membership Functions

FIS links the input values with output using membership functions. In this work, membership functions for input and output variables scaled in the range of 0 to 1 using the triangular (trimf) membership functions of MATLAB. Table 1 shows the scaled membership functions.

Table 1. Scaling of Input and output variables

5.3 Rule Base for Proposed Model

In this work, three input variables are used for predicting output parameter reusability for all three cases and scaled them to three values (Table 1). So, total number of rules for each output variable is 33 which are 27 rules i.e. there are 27 if-then rules constructed using Rule Editor for each output. Figure 1 shows the rule editor for AOSReusability.

Fig. 1.
figure 1

Rule editor for AOSReusability

Rules are constructed on the basis of knowledge for software Reusability. For example, reusability of any software is positively correlated with cohesion and is adversely affected by coupling value [24]. Then rule can be constructed as - If Size and Coupling is low and Cohesion is high, then Reusability is high. In the similar ways, all the 27 rules are constructed for AOSReusability. Some sample rules for are given in Table 2.

Table 2. Rules for AOSReusability

Different set of input values are given as input into the fuzzy model to find the corresponding effect on output variable Reusability. Suppose the value of input variables is: PCohA = 0.5, CEA = 0.5 and ADS = 0.5. These inputs value are provided to the fuzzy model to obtain the output as 0.48 i.e. Medium. Table 3 shows the results of giving some rules as input to the proposed fuzzy based system for AOSReusability.Table 3 shows the results of giving some rules as input to the proposed fuzzy based system for AOSReusability.

Table 3. Values obtained from rule viewer for AOSReusability

It is concluded from the predicted results that the proposed fuzzy model is best suitable for determining the estimations for external quality attributes for AOS. It is clear from the predicted values that cohesion has positive effect on Reusability.

The next section presents a case study AspectJ project AJhotdraw, for validating predictions made for Reusability using proposed fuzzy model approach.

6 Case Study: AJhotdraw

In this section, AJhotdraw an aspectJ project has been studied for validating the predictions made in the proposed fuzzy model for measuring Reusability.

AJhotdraw is the aspect refactoring of Jhotdraw, drawing application developed as display good design patterns in java. AJhotdraw is written in AspectJ, an aspect language that extends java with crosscutting functionality. Many researchers have used AJhotdraw for their research oriented studies on AOS. There are 4 versions of AJhotdraw. Here, AJhotdraw 0.4 release is analysed for measuring Reusability. It is composed of 24 packages, 330 classes and total lines of code are 21542. For this research 20 packages have been analysed. Composition of those 20 packages of AJhotdraw is shown in Table 4.

Table 4. Composition of AJhotdraw

Since we are assessing reusability using package level metrics, Table 5 gives the value of Reusability for each package of AJhotdraw.

Table 5. Package level metric values for AJhotdraw.

Figures 2, 3 and 4 shows the relationship of package cohesion (PCohA), design size and package level coupling with Reusability respectively for each package. It is clear from the above figures that Reusability is positively affected by package cohesion whereas coupling and size has negative effects on Reusability of the packages. Karl Pearson Product Moment correlation is used to calculate the correlation between three input parameters and reusability using the values from Table 5. Correlation values are given in Table 6.

Fig. 2.
figure 2

Relation between reusability and PCohA

Fig. 3.
figure 3

Relation between reusability and Design Size

Fig. 4.
figure 4

Relation between reusability and coupling

Table 6. Correlation between Reusability and Internal attributes

Correlation values in Table 6, has validated the predictions made through the proposed fuzzy model. It is validated that, the reusability is positively correlated with PCohA, whereas it is negatively correlated with Size and Coupling. Hence for system to be more reusable, its coupling must be low and cohesion must be high.

7 Conclusion

In this paper, a framework is proposed to assess Reusability of AOS using rule based fuzzy model. Since measuring internal quality attributes is not an easy task, it is very difficult to quantify them and hence difficult to find their contribution in assessing external quality attributes. Here in this paper, we have tried to find solution to this problem by using fuzzy logic for assessing Reusability using the package level metrics. From the literature, it has been found that very few research works have been done on assessing Reusability using Package level quality attributes for AOS. All the work is done using class level metrics. From literature review it is found that, Reusability is affected by cohesion, coupling, size, inheritance etc. These internal attributes are used as input variables for proposed Fuzzy model approach. Using Rule based fuzzy model, 27 rules are constructed for input variables to assess Reusability. Predicted values are validated by analyzing the results of measured values for Reusability using AJhotdraw, an AspectJ software. Analysis has shown that the predictions made from the fuzzy model approach for assessing Reusability are similar to the values obtained from AJhotdraw. Assessment using the proposed model can help in predicting software reusability automatically, for a module as well for the whole AOS.

The assessment framework proposed in this paper, will help in encouraging software organizations to software which are less maintainable and highly reusable. In future, other quality attributes like maintainability etc. can be assessed using metrics for AOS. Also, in future the proposed model can be applied and cross validated for Aspect oriented approach using the neural network techniques for assessment of external attributes.