Measurement of Software Maintainability Using a Fuzzy Model

: Software maintenance is a task that every development group has to face when the software is delivered to the customers’ site, installed and is operational. The time spent and effort required for keeping software operational consumes about 40-70% of cost of entire life cycle. This study proposes a four parameter integrated measure of software maintainability using a fuzzy model. The study also includes empirical data of maintenance time of projects which has been used to validate the proposed model.


INTRODUCTION
Software maintenance is defined as process of modifying existing operational software while leaving its primary functions intact. Every software needs to be modified to meet customer's requirement in its life cycle. Software maintenance encompasses a broad range of activities including error corrections, enhancement of capabilities, deletion of obsolete capabilities and optimization [1] The value of Software can be enhanced by meeting additional requirements, making it easier to use, more efficient and employing newer technologies. Maintenance may span for fifteen years whereas development may be 1-2 year [2] . Even though it is an important task, it is poorly managed. The fact that you cannot control ,what you cannot measure, makes measurement of maintainability very important.
In literature, some metrics have been proposed for measuring/predicting maintainability. In 1984 a tool was proposed [3] which operated at syntactic level. Then another model [4] was proposed which considered design attributes. Another model was proposed [5] which used quality metrics. Software Maturity index [SMI] [6] considered only modules being added or removed.
Another model [7] was proposed which considers only the design aspect. A fuzzy model [8] has been proposed where, Maintainability is a measure of characteristics of software e.g. source code readability, documentation quality and cohesiveness among source code and documents. It is also seen that maintainability very much depends on the average number of live variables in a program and average life span of variables. Presently there is no model that considers the effect of these two factors. Therefore, a model which integrates the four factors namely average number of Live Variables LV ,average Life Span ( LS ) of variables, the average Cyclomatic Complexity(ACC) and the Comments Ratio (CR) and provides a measure of maintainability, is proposed.
The more, the average number of live variables, the more difficult it would be to develop and to maintain a software.

b. Average live variable span:
The span is the number of statements between two successive references of the some variable [9,10] . The average span size (LS) for a program could be completed using the equation.
c. Comments ratio: Comment ratio is defined as Where s denotes total lines of code and c represents total number of comment lines. The lower the ratio, the better is the readability, and the better the readability, the better is the maintainability. Comments provide better readability and therefore the Comments Ratio is an important factor that affects maintainability. [11] has defined Cyclomatic Complexity as V = e -n + 2p (4) Where e is the number of edges in a program flow graph, n the number of nodes and p the number of connected components. If p= 1, then v= ∏ +1 where ∏ is the number of predicates in the program. The Average Cyclomatic Complexity (ACC) is defined as average of cyclomatic complexities of all modules.  In order to fuzzify the inputs, the following membership functions are chosen namely Low, Medium and High. They are shown in Fig. 2-5.

d. Average cyclomatic complexity: McCabe
Similarly the output variable i.e. maintainability has five membership functions as shown in Fig 6.

MATERIALS AND METHODS
i. All the inputs and outputs were fuzzified as shown in Fig. 2 to 6. ii. All possible combination of inputs were considered which leads to 3 4 i.e. 81 sets. The maintainability in case of all eighty-one combinations is classified as either Very Good, Good, Average, Poor or Very Poor by expert opinion. These lead to formation of 81 rules for the fuzzy model and some of them are shown below: 1. If (CR is low) and (ACCis low) and ( LV is low) and ( LS is low) then maintainability is very good.

If (CR is low) and (ACC is low) and ( LV is low)
and ( LS is med) then maintainability is very good . . . .

If (CR is high) and (ACC is high) and ( LV is high) and ( LS is high) then maintainability is very
poor.
iii. All eighty one riles are inserted and a rule base is created.
Depending on a particular set of inputs, a rule will be fired. iv. Mamdani style of inference is used. v. Using the rule viewer ,output i.e maintainability is observed for a particular set of inputs using the MATLAB Fuzzy tool box. vi. The output is also calculated theoretically using the Centre of gravity.

RESULTS
Output computation for the model: Let us say we have the following inputs to the model.

ACC=2,CR=12, LV =1, LS =130
When those inputs are fuzzified we find that ACC=2 belongs to fuzzy set low with membership grade 1, CR=12 belongs to fuzzy set low with membership grade 1, LV =1 belongs to fuzzy set low with membership grade 1 and LS = 130 belongs to fuzzy set low with membership grade = 0.25 and medium with membership grade 0.5.With these inputs, rule number 1 and 2 fire. During composition of these rules we get the following Min (1,1,1,0.25)=0.25 Min (1,1,1,0 When these two rules are implicated ,we find that the first rule gives maintainability very good to an extent of 0.25 and second rule gives the maintainability value good to the extent of 0.5. This is shown in Defuzzification: Defuzzification of the above output can be obtained by finding the Centre of Gravity [12] of the above fuzzy output.
The effect of these rules was observed also by simulating the model in MATLAB Fuzzy Tool Box. The maintainability for the above mentioned inputs comes out to be 3.2 which is the some as calculated above. The various surface views of the simulated model are shown in Fig. 8 and 9.
Empirical validation: In order to validate the model, ten procedure oriented software projects of undergraduate engineering students were considered. They were chosen only when proper set of input variables were available. Some logical errors were introduced in these projects and time take for corrective maintenance action was measured (Avg. CMT). The maintainability was also calculated using the proposed fuzzy model. The results are shown in Table 1.   It can be seen there is hardly any co-relation between average maintenance time and the four inputs.These four metrics cannot individually predict the maintenance time.
On the other hand a plot of maintainability versus maintenance time is shown in Fig 14. This shows that integrated measure of maintainability is strongly corelated with maintenance time.
Thus the fuzzy model is validated and that the integrated value of maintenance gives better results than any individual input metric is also verified with the help of empirical results.

CONCLUSION
Maintainability can be estimated with the help of fuzzy model and the empirical results prove that the integrated measure of maintenance obtained from this model shows a strong co-relation to the maintenance time.