Skip to main content
Log in

Prioritizing code-smells correction tasks using chemical reaction optimization

  • Published:
Software Quality Journal Aims and scope Submit manuscript

Abstract

The presence of code-smells increases significantly the cost of maintenance of systems and makes them difficult to change and evolve. To remove code-smells, refactoring operations are used to improve the design of a system by changing its internal structure without altering the external behavior. In large-scale systems, the number of code-smells to fix can be very large and not all of them can be fixed automatically. Thus, the prioritization of the list of code-smells is required based on different criteria such as the risk and importance of classes. However, most of the existing refactoring approaches treat the code-smells to fix with the same importance. In this paper, we propose an approach based on a chemical reaction optimization metaheuristic search to find the suitable refactoring solutions (i.e., sequence of refactoring operations) that maximize the number of fixed riskiest code-smells according to the maintainer’s preferences/criteria. We evaluate our approach on five medium- and large-sized open-source systems and seven types of code-smells. Our experimental results show the effectiveness of our approach compared to other existing approaches and three different others metaheuristic searches.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12

Similar content being viewed by others

References

  • Alba, E., & Chicano, F. (2005). Management of software projects with GAs. In Proceedings of the 6th metaheuristics international conference (MIC’05). Elsevier, 13–18, 2005.

  • Alikacem, H., & Sahraoui. H. (2006). Détection d’anomalies utilisant un langage de description de règle de qualité, in actes du 12e colloque LMO.

  • Arcuri, A., & Briand, L. C. (2011). A practical guide for using statistical tests to assess randomized algorithms in software engineering. In Proceedings of the 33rd international conference on software engineering (ICSE ‘11), (pp. 1–10). New York, NY, USA: ACM.

  • Brown, W. J., Malveau, R. C., Brown, W. H., McCornnick, W. H, I. I. I., & Mowbray, T. J. (1998). Anti patterns: Refactoring software, architectures, and projects in crisis. New York: Wiley.

    Google Scholar 

  • Canfora, G., Di Penta, M., Esposito, R., & Andvillani, M. L. (2005) An approach for QoS-aware service composition based on genetic algorithms. In Proceedings of the conference on genetic and evolutionary computation (GECCO’05), (pp. 1069–1075). New York: ACM Press.

  • Cederqvist, P. (2003). Version management with CVS, December 2003. www.cvshome.org/docs/manual/.

  • Chidamber, S. R., & Kemerer, C. F. (1994). A metrics suite for object oriented design. IEEE Transactions on Software Engineering, 20(6), 476–493.

    Article  Google Scholar 

  • Cinnéide, M. Ó., Tratt, L., Harman, M., Counsell, S., & Moghadam, I. H. (2012). Experimental assessment of software metrics using automated refactoring. In Proceedings of empirical software engineering and management (ESEM), pp. 49–58, September 2012.

  • Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). New York, USA: Lawrence Earlbaum Associates.

  • Du Bois, B., Demeyer, S., & Verelst, J. (2004). Refactoring—Improving coupling and cohesion of existing code. In Proceedings of 11th working conference reverse engineering (WCRE), 2004, pp. 144–151.

  • Erlikh, L. (2000). Leveraging legacy system dollars for e-business. IT Professional, 02(3), 17–23.

    Article  Google Scholar 

  • Fatiregun, D., Harman, M., & Hierons, R. (2004). Evolving transformation sequences using genetic algorithms. In SCAM 04, (pp. 65–74). Los Alamitos, CA, USA: IEEE Computer Society Press.

  • Fenton, N., & Pfleeger, S. L. (1997). Software metrics: A rigorous and practical approach (2nd ed.). London: International Thomson Computer Press.

    Google Scholar 

  • Fowler, M., Beck, K., Brant, J., Opdyke, W., & Roberts, D. (1999). Refactoring: Improving the design of existing code (1st ed.). Reading, MA: Addison-Wesley.

    Google Scholar 

  • Freitas, F. G., & Souza, J. T. (2011). Ten years of search based software engineering: A bibliometric analysis. In 3rd international symposium on search based software engineering (SSBSE 2011), 10–12th September 2011, pp. 18–32.

  • Fraser, G., & Arcuri, A. (2013). Handling test length bloat. Software Testing, Verification and Reliability, 23(7), 553–582.

    Article  Google Scholar 

  • Glover, F., & Laguna, M. (1997). Tabu search. Boston, MA: Kluwer Academic Publishers.

    Book  MATH  Google Scholar 

  • Goldberg, D. E. (1989). Genetic algorithms in search, optimization, and machine learning. Reading, MA: Addison-Wesley.

    MATH  Google Scholar 

  • GanttProject. [Online].

  • Harman, M. (2007). The current state and future of search based software engineering. In L. Briand & A. Wolf (Eds.), Future of software engineering 2007 (pp. 342–357). Los Alamitos, CA: IEEE Computer Society Press.

    Google Scholar 

  • Harman, M., & Jones, B. F. (2001). Search-based software engineering. Information and Software Technology, 43(14), 833–839.

    Article  Google Scholar 

  • Harman, M., & Tratt, L. (2007) Pareto optimal search based refactoring at the design level. In Proceedings of the genetic and evolutionary computation conference (GECCO’07), 2007, pp. 1106–1113.

  • Harman, M., Mansouri, S. A., & Zhang, Y. (2012). Search-based software engineering: Trends, techniques and applications. ACM Computing Surveys, 45, 61.

    Article  Google Scholar 

  • Infusion hydrogen: Design flaw detection tool. 2012.

  • Jensen, A., & Cheng, B. (2010). On the use of genetic programming for automated refactoring and the introduction of design patterns. In Proceedings of GECCO. ACM, July 2010.

  • Joshi, P., & Joshi, R. K. (2009). Concept analysis for class cohesion. In Proceedings of the 13th European conference on software maintenance and reengineering, Kaiserslautern, Germany, pp. 237–240, 2009.

  • JFreeChart. [Online].

  • JHotDraw. [Online].

  • iPlasma.

  • Jourdan, L., Basseur, M., & Talbi, E.-G. (2009). Hybridizing exact methods and metaheuristics: A taxonomy. European Journal of Operational Research, 199(3), 620–629.

    Article  MATH  MathSciNet  Google Scholar 

  • Kataoka, Y., Ernst, M. D., Griswold, W. G., & Notkin, D. (2001). Automated support for program refactoring using invariants. In International conference on software maintenance (ICSM), pp. 736–743, 2001.

  • Kennedy, J., & Eberhart, R. C. (1995). Particle swarm optimization. In Proceedings of IEEE international conference neural networks, Perth, Australia, November 1995, pp. 1942–1948.

  • Kessentini, M., Vaucher, S., & Sahraoui, H. (2010). Deviance from perfection is a better criterion than closeness to evil when identifying risky code. In Proceedings of the international conference on automated software engineering, ASE’10, 2010.

  • Kessentini, M., Kessentini, W., Sahraoui, H., Boukadoum, M., & Ouni, A. (2011) Design defects detection and correction by example. In 19th IEEE ICPC11, Kingston, Canada, pp. 81–90.

  • Khomh, F., Penta, M. D., & Gueheneuc, Y.-G. (2009a). An exploratory study of the impact of code smells on software change-proneness. In Proceedings of WCRE 2009 (16th IEEE working conference on reverse engineering), pp. 75–84, 2009.

  • Khomh, F., Vaucher, S., Guéhéneuc, Y.-G., & Sahraoui, H. (2009b). A bayesian approach for the detection of code and design smells. In Proceedings of the ICQS’09.

  • Kilic, H., Koc, E., & Cereci, I. (2011). Search-based parallel refactoring using population-based direct approaches. In Proceedings of the third international conference on search based software engineering, SSBSE’11, pp. 271–272, 2011.

  • Kirkpatrick, S., Gelatt, C. D, Jr, & Vecchi, M. P. (1983). Optimization by simulated annealing. Science, 220(4598), 671–680.

    Article  MATH  MathSciNet  Google Scholar 

  • Lam, A. Y. S., & Li, V. O. K. (2010). Chemical-reaction-inspired metaheuristic for optimization. IEEE Transactions Evolutionary Computation, 14(3), 381–399.

    Article  Google Scholar 

  • Lam, A. Y. S., Li, V. O. -K., & Wei, Z. (2012a). Chemical reaction optimization for the fuzzy rule learning problem. Evolutionary Computation (CEC), 2012 IEEE Congress on 10–15 June 2012, pp. 1–8.

  • Lam, A. Y. S., Li, V. O. K., & Yu, J. J. Q. (2012b). Real-coded chemical reaction optimization. IEEE Transactions Evolutionary Computation, 16(3), 339–353.

    Article  Google Scholar 

  • Lam, A. Y. S., Li, V. O. K., & Xu, J. (2013). On the convergence of chemical reaction optimization for combinatorial optimization. IEEE Transaction Evolutionary Computation, 17(5), 605–620.

    Article  Google Scholar 

  • Le Goues, C., Nguyen, T., Forrest, S., & Weimer, W. (2012). Genprog: A generic method for automatic software repair. IEEE Transactions on Software Engineering, 38(1), 54–72.

    Article  Google Scholar 

  • Marinescu, R. (2004). Detection strategies: Metrics-based rules for detecting design flaws. In Proceedings of the 20th international conference on software maintenance (pp. 350–359). IEEE Computer Society Press.

  • Martin, R. C. (2008). Clean code: A handbook of agile software craftsmanship. Englewood Cliffs: Prentice Hall.

    Google Scholar 

  • McMinn, P. (2004). Search-Based software test data generation: A survey. Software Testing, Verification and Reliability, 14, 2.

    Article  Google Scholar 

  • Mens, T., & Tourwé, T. (2004). A survey of software refactoring. IEEE Transactions on Software Engineering, 30(2), 126–139.

    Article  Google Scholar 

  • Moha, N., Hacene, A., Valtchev, P. & Guéhéneuc, Y.-G. (2008). Refactorings of design defects using relational concept analysis. In R. Medina, & S. Obiedkov (Eds.), Proceedings of the 4th international conference on formal concept analysis (ICFCA 2008), February 2008.

  • Moha, N., Guéhéneuc, Y.-G., Duchien, L., & Meur, A.-F. L. (2010). DECOR: A method for the specification and detection of code and design smells. Transactions on Software Engineering (TSE) 36(1), 20–36.

  • Munro, M. J. (2005). Product metrics for automatic identification of bad smell” design problems in java source-code. In F. Lanubile, & C. Seaman (Eds.), Proceedings of the 11th international software metrics symposium. IEEE Computer Society Press (2005).

  • Ó Cinnéide, M. (2000). Automated application of design patterns: A refactoring approach. Ph.D. dissertation, University of Dublin, Trinity College, Department of Computer Science, 2000.

  • O’Keeffe, M., & Cinnéide, M. O. (2006). Search-based refactoring for software maintenance. Journal of Systems and Software, 81(4), 502–516.

    Article  Google Scholar 

  • Olbrich, S., Cruzes, D., Basili, V. R., & Zazworka, N. (2009) The evolution and impact of code smells: A case study of two open source systems. In ESEM, pp. 390–400.

  • Olbrich, S. M., Cruzes, D. S., & Sjoberg, D. I. K. (2010). Are all code smells harmful? A study of god classes and brain classes in the evolution of three open source systems. In Software maintenance, ICSM 2010, pp. 1–10, Timisoara, 2010.

  • Opdyke, W. F. (1992). Refactoring: A program restructuring aid in designing object-oriented application frameworks. Ph.D. thesis, University of Illinois at Urbana-Champaign, 1992.

  • Otero, F. E. B., Johnson, C. G., Freitas, A. A., & Thompson., S. J. (2010) Refactoring in automatically generated programs. In Search based software engineering, international symposium on, 0, 2010.

  • Ouni, A., Kessentini, M., Sahraoui, H., & Boukadoum, M. (2012a). Maintainability defects detection and correction: A multi-objective approach. Journal of Automated Software Engineering, 20(1), 47–79.

  • Ouni, A., Kessentini, M., Sahraoui, H., & Hamdi, M. S. (2012b) Search-based refactoring: Towards semantics preservation. In 28th IEEE international conference on software maintenance (ICSM), (pp. 347–356), September 23–28, 2012.

  • Ouni, A., Kessentini, M., & Sahraoui, H. (2013). Search-based refactoring using recorded code changes. In Proceedings of the 17th European conference on software maintenance and reengineering (CSMR), Genova, Italy, March 5–8, 2013.

  • Prete, K., Rachatasumrit, N., Sudan, N., & M. Kim. (2010) Template-based reconstruction of complex refactorings. In Proceedings of the international conference on software maintenance (ICSM), 2010.

  • Qayum, F., & Heckel, R. (2009) Local search-based refactoring as graph transformation. In Proceedings of 1st international symposium on search based software engineering, pp. 43–46, 2009.

  • Ratiu, D., Ducasse, S., Gîrba, T., & Marinescu, R. (2004) Using history information to improve design flaws detection. In CSMR, pp. 223–232.

  • Riel, A. J. (1996). Object-oriented design heuristics. Reading, MA: Addison-Wesley.

    Google Scholar 

  • Roberts, D. B. (1999). Practical analysis for refactoring. PhD thesis, Department of Computer Science, University of Illinois, 1999.

  • Sahraoui, H., Godin, R., & Miceli, T. (2000). Can metrics help to bridge the gap between the Improvement of OO design quality and its automation? ICSM, 2000, 154–162.

    Google Scholar 

  • Seng, O., Stammel, J., & Burkhart, D. (2006). 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), 2006, pp. 1909–1916.

  • Sun, Y., Lam, A. Y. S., Li, V. O. -K., Xu, J., & Yu, J. J. Q. (2012). Chemical reaction optimization for the optimal power flow problem. Evolutionary Computation (CEC), 2012 IEEE Congress on 10–15 June 2012, pp. 1–8.

  • Tahvildari, L., & Kontogiannis, K. (2003). A metric-based approach to enhance design quality through meta-pattern transformation. In Proceedings of the 7th European conference on software maintenance and reengineering, Benevento, Italy, pp. 183–192, 2003.

  • Tsantalis, N., Chaikalis, T., & Chatzigeorgiou, A. (2008). JDeodorant: Identification and removal of type-checking bad smells. In Proceedings of CSMR2008, pp 329–331.

  • Vallée-Rai, R., Gagnon, E., Hendren, L. J., Lam, P., Pominville, P., & Sundaresan, V. (2000). Optimizing Java bytecode using the Soot framework: Is it feasible? In International conference on compiler construction, pp. 18–34, 2000.

  • Xu, J., Lam, A. Y. S., & Li, V. O. K. (2011). Chemical reaction optimization for task scheduling in grid computing. IEEE Transactions on Parallel and Distributed Systems, 22(10), 1624–1631.

    Article  Google Scholar 

  • Xerces-J. [Online].

  • Yu, J. J. Q., Lam, A. Y. S., & Li, V. O. -. (2012) Real-coded chemical reaction optimization with different perturbation functions. Evolutionary Computation (CEC), 2012 IEEE Congress on 10–15 June 2012, pp. 1–8.

  • Zhang, Y., Finkelstein, A., & Andharman, M. (2008). Search based requirements optimisation: Existing work and challenges. In Proceedings of the 14th international working conference, requirements engineering: Foundation for software quality (RefsQ’08). Lecture notes in computer science, (Vol. 5025, pp. 88–94). New York: Springer.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ali Ouni.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Ouni, A., Kessentini, M., Bechikh, S. et al. Prioritizing code-smells correction tasks using chemical reaction optimization. Software Qual J 23, 323–361 (2015). https://doi.org/10.1007/s11219-014-9233-7

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11219-014-9233-7

Keywords

Navigation