Automated Software Engineering

, Volume 20, Issue 1, pp 47–79 | Cite as

Maintainability defects detection and correction: a multi-objective approach

  • Ali Ouni
  • Marouane Kessentini
  • Houari Sahraoui
  • Mounir Boukadoum


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.


Maintainability defects Software maintenance Search-based software engineering Multi-objective optimization By example Effort 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 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) Google Scholar
  2. Boehm, B.: Software Engineering Economics. Prentice Hall, New York (1981) zbMATHGoogle Scholar
  3. 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) Google Scholar
  4. Bratko, I., Muggleton, S.: Applications of inductive logic programming. Commun. ACM 38(11), 65–70 (1995) CrossRefGoogle Scholar
  5. 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) Google Scholar
  6. Chidamber, S.R., Kemerer, C.F.: A metrics suite for object-oriented design. IEEE Trans. Softw. Eng. 20(6), 293–318 (1994) CrossRefGoogle Scholar
  7. Davis, R., Buchanan, B., Shortcliffe, E.H.: Production rules as a representation for a knowledge-base consultation program. Artif. Intell. 8, 15–45 (1977) zbMATHCrossRefGoogle Scholar
  8. 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) CrossRefGoogle Scholar
  9. Dhambri, K., Sahraoui, H.A., Poulin, P.: Visual detection of design anomalies. In: CSMR. IEEE, pp. 279–283 (2008) Google Scholar
  10. Erni, K., Lewerentz, C.: Applying design metrics to object-oriented frameworks. In: Proc. IEEE Symp. Software Metrics. IEEE Comput. Soc., Los Alamitos (1996) Google Scholar
  11. Fenton, N., Pfleeger, S.L.: Software Metrics: A Rigorous and Practical Approach, 2nd edn. International Thomson Computer Press, London (1997) Google Scholar
  12. Fowler, M.: Refactoring—improving the design of existing code, 1st edn. Addison-Wesley, Reading (1999) Google Scholar
  13. Gaffney, J.E.: Metrics in software quality assurance. In: Proc. of the ACM ’81 Conference, pp. 126–130. ACM, New York (1981) CrossRefGoogle Scholar
  14. Goldberg, D.E.: Genetic Algorithms in Search, Optimization and Machine Learning. Addison-Wesley/Longman, Boston (1989) zbMATHGoogle Scholar
  15. Harman, M., Clark, J.A.: Metrics are fitness functions too. In: IEEE METRICS, pp. 58–69. IEEE Computer Society, Los Alamitos (2004) Google Scholar
  16. 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) CrossRefGoogle Scholar
  17. Heckel, R.: Algebraic graph transformations with application conditions, M.S. thesis, TU Berlin, (1995) Google Scholar
  18. 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) CrossRefGoogle Scholar
  19. 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) Google Scholar
  20. 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) Google Scholar
  21. 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) Google Scholar
  22. 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) CrossRefGoogle Scholar
  23. Koza, J.R.: Genetic Programming: On the Programming of Computers by Means of Natural Selection. MIT Press, Cambridge (1992) zbMATHGoogle Scholar
  24. 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) CrossRefGoogle Scholar
  25. Marinescu, R.: Detection strategies: metrics-based rules for detecting design flaws. In: Proc. of ICM’04, pp. 350–359 Google Scholar
  26. 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) Google Scholar
  27. Mens, T., Tourwé, T.: A survey of software refactoring. IEEE Trans. Softw. Eng. 30(2), 126–139 (2004) CrossRefGoogle Scholar
  28. Menzies, T., Chen, Z., Hihn, J., Lum, K.: Selecting best practices for effort estimation. IEEE Trans. Softw. Eng. 32(11), 883–895 (2006) CrossRefGoogle Scholar
  29. 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) CrossRefGoogle Scholar
  30. O’Keeffe, M., Cinnéide, M.: Search-based refactoring: an empirical study. J. Softw. Maint. 20(5), 345–364 (2008) Google Scholar
  31. Opdyke, W.F.: Refactoring: a program restructuring aid in designing object-oriented application frameworks, Ph.D. thesis, University of Illinois at Urbana-Champaign (1992) Google Scholar
  32. Raedt, D.: Advances in Inductive Logic Programming, 1st edn. IOS Press, Lansdale (1996) zbMATHGoogle Scholar
  33. 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) Google Scholar
  34. 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) CrossRefGoogle Scholar
  35. 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) CrossRefGoogle Scholar

Copyright information

© Springer Science+Business Media, LLC 2012

Authors and Affiliations

  • Ali Ouni
    • 1
  • Marouane Kessentini
    • 2
  • Houari Sahraoui
    • 1
  • Mounir Boukadoum
    • 3
  1. 1.DIROUniversité de MontréalMontréalCanada
  2. 2.CSMissouri University of Science and TechnologyRollaUSA
  3. 3.DIUniversité du Québec à MontréalMontréalCanada

Personalised recommendations