Abstract
Software defects often lead to bugs, runtime errors and software maintenance difficulties. They should be systematically prevented, found, removed or fixed all along the software lifecycle. However, detecting and fixing these defects is still, to some extent, a difficult, time-consuming and manual process. In this paper, we propose a two-step automated approach to detect and then to correct various types of maintainability defects in source code. Using Genetic Programming, our approach allows automatic generation of rules to detect defects, thus relieving the designer from a fastidious manual rule definition task. Then, we correct the detected defects while minimizing the correction effort. A correction solution is defined as the combination of refactoring operations that should maximize as much as possible the number of corrected defects with minimal code modification effort. We use the Non-dominated Sorting Genetic Algorithm (NSGA-II) to find the best compromise. For six open source projects, we succeeded in detecting the majority of known defects, and the proposed corrections fixed most of them with minimal effort.
Similar content being viewed by others
References
Alikacem, H., Sahraoui, H.: Détection d’anomalies utilisant un langage de description de règle de qualité. In: actes du 12e colloque LMO (2006)
Boehm, B.: Software Engineering Economics. Prentice Hall, New York (1981)
Boehm, B., Horowitz, E., Madachy, R., Reifer, D., Clark, B.K., Steece, B., Brown, A.W., Chulani, S., Abts, C.: Software Cost Estimation with Cocomo II. Prentice Hall, New York (2000)
Bratko, I., Muggleton, S.: Applications of inductive logic programming. Commun. ACM 38(11), 65–70 (1995)
Brown, W.J., Malveau, R.C., Brown, W.H., McCormick, H.W. III, Mowbray, T.J.: Anti Patterns: Refactoring Software, Architectures, and Projects in Crisis, 1st edn. Wiley, New York (1998)
Chidamber, S.R., Kemerer, C.F.: A metrics suite for object-oriented design. IEEE Trans. Softw. Eng. 20(6), 293–318 (1994)
Davis, R., Buchanan, B., Shortcliffe, E.H.: Production rules as a representation for a knowledge-base consultation program. Artif. Intell. 8, 15–45 (1977)
Deb, K., Pratap, A., Agarwal, S., Meyarivan, T.: A fast and elitist multiobjective genetic algorithm: NSGA-II. IEEE Trans. Evol. Comput. 6, 182–197 (2002)
Dhambri, K., Sahraoui, H.A., Poulin, P.: Visual detection of design anomalies. In: CSMR. IEEE, pp. 279–283 (2008)
Erni, K., Lewerentz, C.: Applying design metrics to object-oriented frameworks. In: Proc. IEEE Symp. Software Metrics. IEEE Comput. Soc., Los Alamitos (1996)
Fenton, N., Pfleeger, S.L.: Software Metrics: A Rigorous and Practical Approach, 2nd edn. International Thomson Computer Press, London (1997)
Fowler, M.: Refactoring—improving the design of existing code, 1st edn. Addison-Wesley, Reading (1999)
Gaffney, J.E.: Metrics in software quality assurance. In: Proc. of the ACM ’81 Conference, pp. 126–130. ACM, New York (1981)
Goldberg, D.E.: Genetic Algorithms in Search, Optimization and Machine Learning. Addison-Wesley/Longman, Boston (1989)
Harman, M., Clark, J.A.: Metrics are fitness functions too. In: IEEE METRICS, pp. 58–69. IEEE Computer Society, Los Alamitos (2004)
Harman, M., Tratt, L.: Pareto optimal search based refactoring at the design level. In: Proceedings of the Genetic and Evolutionary Computation Conference (GECCO’07), pp. 1106–1113 (2007)
Heckel, R.: Algebraic graph transformations with application conditions, M.S. thesis, TU Berlin, (1995)
Kapser, C., Godfrey, M.W.: Cloning considered harmful considered harmful. In: Proceedings of the 13th Working Conference on Reverse Engineering (WCRE’06), pp. 19–28. IEEE Comput. Soc., Los Alamitos (2006)
Kataoka, Y., Ernst, M.D., Griswold, W.G., Notkin, D.: Automated support for program refactoring using invariants. In: Proc. Int’l Conf. Software Maintenance, pp. 736–743. IEEE Comput. Soc., Los Alamitos (2001)
Kessentini, M., Vaucher, S., Sahraoui, H.: Deviance from perfection is a better criterion than closeness to evil when identifying risky code. In: Proc. of the International Conference on Automated Software Engineering (ASE’10) (2010)
Khomh, F., Vaucher, S., Guéhéneuc, Y.-G., Sahraoui, H.: A Bayesian approach for the detection of code and design smells. In: Proc. of the ICQS’09 (2009)
Kothari, S.C., Bishop, L., Sauceda, J., Daugherty, G.: A pattern-based framework for software anomaly detection. Softw. Qual. J. 12(2), 99–120 (2004)
Koza, J.R.: Genetic Programming: On the Programming of Computers by Means of Natural Selection. MIT Press, Cambridge (1992)
Liu, H., Yang, L., Niu, Z., Ma, Z., Shao, W.: Facilitating software refactoring with appropriate resolution order of bad smells. In: Proc. of the ESEC/FSE ’09, pp. 265–268 (2009)
Marinescu, R.: Detection strategies: metrics-based rules for detecting design flaws. In: Proc. of ICM’04, pp. 350–359
Mehta, A., Heineman, G.T.: Evolving legacy system features into fine-grained components. In: Proceedings of the 24th International Conference on Software Engineering, pp. 417–427. ACM Press, New York (2002)
Mens, T., Tourwé, T.: A survey of software refactoring. IEEE Trans. Softw. Eng. 30(2), 126–139 (2004)
Menzies, T., Chen, Z., Hihn, J., Lum, K.: Selecting best practices for effort estimation. IEEE Trans. Softw. Eng. 32(11), 883–895 (2006)
Moha, N., Guéhéneuc, Y.-G., Duchien, L., Meur, A.-F.L.: DECOR: A method for the specification and detection of code and design smells. IEEE Trans. Softw. Eng. 36, 20–36 (2009)
O’Keeffe, M., Cinnéide, M.: Search-based refactoring: an empirical study. J. Softw. Maint. 20(5), 345–364 (2008)
Opdyke, W.F.: Refactoring: a program restructuring aid in designing object-oriented application frameworks, Ph.D. thesis, University of Illinois at Urbana-Champaign (1992)
Raedt, D.: Advances in Inductive Logic Programming, 1st edn. IOS Press, Lansdale (1996)
Sahraoui, H., Godin, R., Miceli, T.: Can metrics help to bridge the gap between the improvement of OO design quality and its automation. In: Proc. of the International Conference on Software Maintenance (ICSM’00) (2000)
Seng, O., Stammel, J., Burkhart, D.: Search-based determination of refactorings for improving the class structure of object-oriented systems. In: Proceedings of the Genetic and Evolutionary Computation Conference (GECCO’06), pp. 1909–1916 (2006)
Zitzler, E., Thiele, L.: Multiobjective optimization using evolutionary algorithms—a comparative case study. In: Eiben, A.E., Back, T., Schoenauer, M., Schwefel, H.-P. (eds.) Parallel Problem Solving from Nature, V, pp. 292–301. Springer, Berlin (1998)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Ouni, A., Kessentini, M., Sahraoui, H. et al. Maintainability defects detection and correction: a multi-objective approach. Autom Softw Eng 20, 47–79 (2013). https://doi.org/10.1007/s10515-011-0098-8
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10515-011-0098-8