International Journal of Engineering Trends and Technology (IJETT) – Volume 10 Number 1 - Apr 2014 Fuzzy Based Approach for Predicting Software Maintainability Vishal Choudhary#1 and Dr.P.K Bharti#2 Department of MCA AIMT,Knowledge Park-3 Greater Noida-(India) Abstract-Software maintenance is a process of 1. METRICS FOR MAINTAINABILITY modifying existing operational software while leaving Researcher have tried to quantify maintainability in its primary functions intact. Software maintenance different types of measures[12,13,14].here we consider encompasses a broad range of activates, like error four correction, enhancement of capabilities, deletion of maintainability,i.e average number of live variables, obsolete average life span of variables, average cyclomatic ASSESSMENT capabilities and optimization.sofwtare maintainability assessment is major issue these days. producing software that is easy to maintain may save large costs in industries. the maintenance of existing major aspects of software to assess complexity and comment ratio. a) AVERAGE NUMBER OF LIVE VARIABLES(ALV): a variable is live at a particular statement only if a certain software can account for 70% of the total efforts putnumber of statements reference it before or after that in application development[Pres05].the value of statement. the average number of live variable is the sum software can be enhanced by meeting additional of the count of live variables divided by the count of requirements, making it easier to use, improving executable statements. the higher, the average number of efficiency and employing newer technologies. this paper discusses various issues and challenges, related with the maintainability assessment of software systems. The present work proposes a fuzzy logic based approach for quantification of maintainability of software system based on combined effect of four major aspects of software. i.e average number of live variables ,average life span of variables, average cyclomatic complexity and the comment ratio. Classroom projects are considered to estimate and validate the proposed maintainability model. live variables, the more difficult it would be to develop and to maintain the software. b) THE AVERAGE LIFE SPAN OF VARIABLES(ALS): The life span of a variable is defined as the number of statements between two successive references of the same variable. The average life span of variable is the Ratio of the sum of life spans to number of variables. C) COMMENT RATIO(CR): The comment ratio is defined as CR=(S+C)/C------------------- (1) Where S denotes total line of code Keyword: Cylomatic complexity, comment ratio, maintainability, triangular fuzzy number ISSN: 2231-5381 C represents total number of comment lines. http://www.ijettjournal.org Page 8 International Journal of Engineering Trends and Technology (IJETT) – Volume 10 Number 1 - Apr 2014 A lower comment ratio means better readability and the better maintainability. D) AVERAGE CYCLOMATIC COMPLEXITY (ACC): The average cyclomatic complexity is defined as the average cyclomatic complexity of all modules, where cyclomatic complexity is defined as V=e-n+2p----------------------- (2) Where e is number of edges in a program flow TABLE2: COMPLEXITY AND WEIGHT FOR ALS ALS complexity Weight 0-20 Low W1 20-150 Medium W2 150-400 High W3 400 or more Very high W4 TABLE4: COMPLEXITY AND WEIGHT FOR ACC ACC 0-5 5-13 13-18 18 or more complexity Low Medium High Very high Weight W1 W2 W3 W4 graph,n is the number of nodes, and p is the number of connected Components. Maintainability of software declines with increasing average cyclomatic complexity. TABLE5: COMPLEXITY AND WEIGHT FOR CR ALS complexity Weight 0-4 Low W1 4-8 Medium W2 8-12 High W3 12 or more Very high W4 2. FUZZY SET THEORY FOR MAINTAINABILITY: The set w1,w2,w3 and w4 may be different for program Recently many researchers have proposed some in different languages . integrated models for maintainability measurement, 3. FUZZIFICATION: which leave significant room for further improvements. The complexity attributes low, medium and high for the here we proposed a methodology to improve the four metrics ALV,ALS,ACC,and CR are taken as maintainability metrics system based on the fuzzy set theory.ALV,ALS,ACC and CR are classified in four levels of complexity i.e low, medium high and very high triangular fuzzy number(TFN).membership functions are evaluated using complexity and coefficient matrices. fuzzy pictorial representation of TFNs for ALV,ALS and corresponding weights are then assigned for each. ACC and CR are shown in Figure: The complexity levels and their corresponding weights for ALV,ALS ACC and CRR are described in table 1 and 2 TABLE1: COMPLEXITY AND WEIGHTS FOR ALV ALV 0-2 2-5 5-8 8 or more Complexity Low Medium High Very High ISSN: 2231-5381 weight W1 W2 W3 W4 Fig1.Fuzzy Pictorial Representation of ALV http://www.ijettjournal.org Page 9 International Journal of Engineering Trends and Technology (IJETT) – Volume 10 Number 1 - Apr 2014 µ∗ < ≤ µ∗ + ( − µ) ∗ , < ≤ 20 µ∗ + ( − µ) ∗ , < ≤ 85 Rals= µ ∗ + ( − µ) ∗ , < ≤ 150 ⎨ µ∗ + ( − µ) , < ≤ 275 ⎪ ⎪µ ∗ + ( − µ) ∗ , < ≤ 400 ⎩ > 400 ⎧ ⎪ ⎪ Fig2.Fuzzy Pictorial Representation of ALS µ∗ < ≤ . ⎧ µ∗ + ( − µ) ∗ , . < ≤5 ⎪ ⎪ µ∗ + ( − µ) ∗ , < ≤ Racc= µ∗ + ( − µ) ∗ , < ≤ ⎨ µ∗ + ( − µ) , < ≤ . ⎪ ⎪µ ∗ + ( − µ) ∗ , . < ≤ ⎩ > 18 Fig3.Fuzzy Pictorial Representation of ACC µ∗ < ≤ µ∗ + ( − µ) ∗ , < ≤4 µ∗ + ( − µ) ∗ , < ≤6 Rcr= µ∗ + ( − µ) ∗ , < ≤8 ⎨ µ∗ + ( − µ) , < ≤ 10 ⎪ ⎪µ ∗ + ( − µ) ∗ , < ≤ 12 ⎩ > 12 ⎧ ⎪ ⎪ Fig4.Fuzzy Pictorial Representation of CR 4. Defuzzification: Defuzzification process is applied to evaluate crisp value Where µ represents grade of membership function. Since maintainability of software is inversely proportional to ALV,ALS,ACC and CR respectively. The following equation used to evaluate maintainability of maintainability factors for ALV,ALS,ACC and Maintainability=Ralv*Rals*Rcrr*Racc 5. Experimental Results: CRR.Ralv Racc and Rcr are used to represent corresponding factors In order to measure the performance of our system,we of have used a published dataset of nine classroom maintainability for ALV,ALS,ACC and CR repectively.Defuzzification rules are defined in the projects[AGGA05].repair rate is considered for following equations. validation of results from present fuzzy logic based model. Repair rate is taken as inverse of average corrective maintainence time. µ∗ ⎧ µ∗ ⎪ ⎪ µ∗ Ralv= µ ∗ ⎨ µ∗ ⎪ ⎪µ ∗ ⎩ < ≤1 + ( − µ) ∗ , < ≤2 + ( − µ) ∗ , < ≤ 3.5 + ( − µ) ∗ , . < ≤5 + ( − µ) , < ≤ 6.5 + ( − µ) ∗ , . < ≤8 >8 Repair rate= Where Average CMT=average Corrective Maintenance Time.we considered the following values for weight factors for different levels of complexity. W1=0.5,W2=0.4,W3=0.3 and W5=0.2 ISSN: 2231-5381 http://www.ijettjournal.org Page 10 International Journal of Engineering Trends and Technology (IJETT) – Volume 10 Number 1 - Apr 2014 Table 6: Validation Results for Maintainability Assessment Model. P.NO ALV ALS ACC CR 1 2 3 4 5 6 7 8 9 2.5 1.58 4.41 3.95 2.32 3.14 3.14 5.86 6 132 43.8 238 292 118 288 141 298 300 11.5 12.6 5.28 13.7 7.43 10.7 9.37 7.0 10.7 7.74 5.62 8.30 8.80 7.32 9.23 6.89 7.00 8.80 Maintainability 0.083 0.149 0.115 0.066 0.135 0.071 0.088 0.076 0.056 Repair rate 0.062 0.065 0.056 0.047 0.067 0.056 0.058 0.045 0.040 Variation of ALS with Reapir rate 350 300 250 200 150 100 50 0 1 2 3 Variation of ALV with maitainability 4 5 6 7 8 9 Project Number 7 ALS Repair rate 6 Fig 6.Variation of ALS with repair 5 rate Variation of CR with Repair rate 4 ALV 0.16 Maintainability 0.14 3 2 0.12 0.1 1 0.08 0 0.06 1 2 3 4 5 6 7 8 9 10 PROJECT NO. 0.04 Repair rate CR 0.02 Fig 5:variation of ALV with maintainability 0 The graph of maintainability of nine projects 1 2 3 4 5 6 Project no. 7 8 under study from proposed model is compared which shows a strong correlation between Fig7:variation of CR with Reapir rate integrated measure of maintainability with maintenance time ISSN: 2231-5381 http://www.ijettjournal.org Page 11 9 International Journal of Engineering Trends and Technology (IJETT) – Volume 10 Number 1 - Apr 2014 7. REFERENCES Maintainablity and Repair rate 1.A Mathematical Study of Fuzzy Logic Techniques in Software 0.25 0.2 Engineering Measurements Er. Kailash Aseri et al./ International Journal Computer of Science & Engineering Technology (IJCSET).2012 0.15 Repair rate 0.1 2.Abrahamsson P., Moser R., Pedrycz W., Sillitti A., Succi G. (2007), "Effort Prediction in Iterative Software Development Processes -- Maintainability 0.05 Incremental Versus Global Prediction Models", Proceedings of the First International Symposium on Empirical Software Engineering and Measurement (ESEM). 0 1 2 3 4 5 6 7 8 9 3. Engel, A., Shachar, S., Measuring and potimizing systems quality Project No. costs and project duration, systems engineering journal 9 (3), 259-280, 2006. Fig8: comparison of maintainability and repair rate 4. Albrecht A.J. (1979), “Measuring Application Development 6. Conclusion: Productivity,” Proc. IBM Applications Development Symp., SHARE- In this paper a method is proposed for predicting the Guide, pp. 83-92. 5.McCabe,T.,A complexity measure,IEEE Transactions on Software maintainability of a software application based on the engineering,2(4):308-320,1976. combined effect of four important factors.ALV, ALS, 6.Banker,R.,Davis,G.and slaughter,S.A.,Software complexity and software maintenance effort: a field of study management science ACC, and CR. This integrated approach gives a true ,44:433-450,1998. Picture of the software maintainability. The model is 7. validated on select software projects to check the usefulness of the approach. the maintainability result of Agarwal, M. (2007). Fuzzy logic control of washing machines.http://softcomputing.tripod.com/ 8. G. D. Boetticher, “An assessment of metric contribution in the construction of a neural network-based effort estimator”, Proceedings the proposed model show excellent correlation with repair rate, where as individual factors show a little of Second International Workshop on Soft Computing Applied to Software Engineering, 2001. 9. W. Pedrycz, H. F. Peters, and S. Ramanna, “A fuzzy set approach to correlation with the same. Lower value of cost estimation of software projects”, Proceedings of IEEE Canadian Conference on Electrical and Computer Engineering, Alberta, Canada, maintainability indicates the need for improvement in software, so that the maintenance coast can be reduced. 1999. 10. M. W. Nisar, and Y.-J. Wang, and M. Elahi, "Software Development Effort Estimation Using Fuzzy Logic – A Survey", in 5th A crisp value for maintainability can help software International Conference on Fuzzy Systems and Knowledge Discovery, 2008, pp. 421- 427. managers to judge the maintenance efforts required for various maintenance activities. further the measured 11. Geoffery K.Gill and chris F.Kemeren Cyclomatic Density and software maintenance productivity,IEEE transaction on software engineering.Vol 17,No.12 1284-1288.december 1991 value can be used to estimate changeability and 12.Berns,G.Assessing software maintainability communication of ACM,27:14-13,1984. reusability. The technique of fuzzy logic used in study is sufficiently general and can be easily applied to other 13.Land R.,Measurements of Software maintainabaility,In proceeding of ARTES Graduate Student conference ARTES,2002. 14.Aggarwal K.K singh&puri,measurement of software maintainability areas of quantitative software engineering. ISSN: 2231-5381 using Fuzzy model.journal of computer science,1(4) 538-542,2005. http://www.ijettjournal.org Page 12