Skip to main content

An Approach for Semantically-Enriched Recommendation of Refactorings Based on the Incidence of Code Smells

  • Conference paper
  • First Online:
Book cover Enterprise Information Systems (ICEIS 2017)

Abstract

Code smells are symptoms of bad decisions on the design and development of software. The occurrence of code smells in software can lead to costly consequences. Refactorings are considered adequate resources when it comes to reducing or removing the undesirable effects of smells in software. Ontologies and semantics can play a substantial role in reducing the interpretation burden of software engineers as they have to decide about adequate refactorings to mitigate the impact of smells. However, related work has given little attention to associating the recommendation of refactorings with the use of ontologies and semantics. Developers can benefit from the combination of code smells detection with a semantically-oriented approach for recommendation of refactorings. To make this possible, we expand the application of our previous ontology, ONTOlogy for Code smEll ANalysis (ONTOCEAN), to combine it with a new one, Ontology for SOftware REfactoring (OSORE). We also introduce a new tool, our REfactoring REcommender SYStem (RESYS) which is capable of binding our two ontologies. As a result, refactorings are automatically chosen and semantically linked to their respective code smells. We also conducted a preliminary evaluation of our approach in a real usage scenario with four open-source software projects.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    ‘DC’ is used as an example to illustrate the representation of refactorings, but OSORE contains other ones. The full schema of OSORE’s ontological classes and instances can be found at the end of this paper.

  2. 2.

    We used OCEAN in our previous work to automate the detection of code smells.

  3. 3.

    http://owlapi.sourceforge.net/.

  4. 4.

    https://jersey.github.io/.

  5. 5.

    Assertional Box.

  6. 6.

    Terminological Box.

  7. 7.

    https://github.com/junit-team.

  8. 8.

    https://github.com/apache/log4j.

  9. 9.

    https://github.com/google/guava.

  10. 10.

    https://github.com/dbfit.

  11. 11.

    We called such developers ‘code smells propagators’.

  12. 12.

    The name of the developer was blurred out for privacy.

  13. 13.

    https://www.w3.org/TR/sparql11-overview/.

  14. 14.

    All prefixes of referenced ontologies has been shortened to better fit in article’s page.

  15. 15.

    http://protege.stanford.edu/.

  16. 16.

    Details about how to use our ontologies and tools can be found at: https://github.com/luispscarvalho/resys/wiki.

References

  1. Vidal, S.A., Marcos, C., Díaz-Pace, J.A.: An approach to prioritize code smells for refactoring. J. Autom. Softw. Eng. 23(3), 501–532 (2016)

    Article  Google Scholar 

  2. Lu, J., Wu, D., Mao, M., Wang, W., Zhang, G.: Recommender system application developments: a survey. Decis. Support Syst. 74, 12–32 (2015)

    Article  Google Scholar 

  3. Fraihat, S., Shambour, Q.: A framework of semantic recommender system for e-Learning. J. Softw. 10(3), 317–330 (2015)

    Article  Google Scholar 

  4. Ouni, A., Kessentini, M., Ó Cinnéide, M., Sahraoui, H., Deb, K., Inoue, K.: MORE: a multi-objective refactoring recommendation approach to introducing design patterns and fixing code smells. J. Softw. Evol. Process 29(5), (2017)

    Google Scholar 

  5. Montuschi, P., Lamberti, F., Gatteschi, V., Demartini, C.: A semantic recommender system for adaptive learning. IEEE IT Professional 17(5), 50–58 (2015)

    Article  Google Scholar 

  6. Espín, V., Hurtado, M.V., Noguera, M.: Nutrition for elder care: a nutritional semantic recommender system for the elderly. Expert Syst. 33(2), 201–210 (2016)

    Article  Google Scholar 

  7. Yoshida, N., Saika, T., Choi, E., Ouni, A., Inoue, K.: Revisiting the relationship between code smells and refactoring. In: 24th International Conference on Program Comprehension (ICPC), pp. 1–4. IEEE Press (2016)

    Google Scholar 

  8. Emden, V., Leon, M.: Java quality assurance by detecting code smells. In: 9th Working Conference on Reverse Engineering, pp. 97–106. IEEE Press (2002)

    Google Scholar 

  9. Carvalho, L.P.S., Novais, R., Salvador, L.N., Mendonça, M.: An ontology-based approach to analyze the occurrence of code smells in software. In: 19th International Conference on Enterprise Information Systems (ICEIS), Portugal (2017)

    Google Scholar 

  10. Meananeatra, P., Rongviriyapanish, S., Apiwattanapong, T.: Using software metrics to select refactoring for long method bad smell. In: 8th Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology (ECTI) Association of Thailand, Thailand, pp. 492–495 (2011)

    Google Scholar 

  11. Counsell, S., Hassoun, Y., Loizou, G., Najjar, R.: Common refactorings, a dependency graph and some code smells: an empirical study of Java OSS. In: Proceedings of the 2006 ACM/IEEE International Symposium on Empirical Software Engineering (ISESE), Brazil, pp. 288–296 (2006)

    Google Scholar 

  12. Fontana, F.A., Mangiacavalli, M., Pochiero, D., Zanoni, M.: On experimenting refactoring tools to remove code smells. In: Scientific Workshop Proceedings of the XP2015, Finland, pp. 7:1–7:8 (2015)

    Google Scholar 

  13. Rodriguez, A., Longo, M., Zunino, A.: Using bad smell-driven code refactorings in mobile applications to reduce battery usage. In: Simposio Argentino de Ingeniería de Software (ASSE), Rosario (2015)

    Google Scholar 

  14. Codina, V., Ceccaroni, L.: Taking advantage of semantics in recommendation systems. In: 13th International Conference of the Catalan Association for Artificial Intelligence, Amsterdam, The Netherlands, pp. 163–172 (2010)

    Google Scholar 

  15. Hamza, H., Counsell, S., Hall, T., Loizou, G.: Code smell eradication and associated refactoring. In: Proceedings of the 2nd Conference on European Computing Conference, Malta, pp. 102–107 (2008)

    Google Scholar 

  16. Kollia, I., Glimm, B., Horrocks, I.: SPARQL query answering over OWL ontologies. In: Antoniou, G., Grobelnik, M., Simperl, E., Parsia, B., Plexousakis, D., De Leenheer, P., Pan, J. (eds.) ESWC 2011. LNCS, vol. 6643, pp. 382–396. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-21034-1_26

    Chapter  Google Scholar 

  17. Fowler, Ma., Kent, B.: Refactoring: Improving the Design of Existing Code. Addison-Wesley Professional, Reading (1999)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Luis Paulo da Silva Carvalho or Renato Lima Novais .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG, part of Springer Nature

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Carvalho, L.P.d.S., Novais, R.L., Salvador, L.d.N., Neto, M.G.d.M. (2018). An Approach for Semantically-Enriched Recommendation of Refactorings Based on the Incidence of Code Smells. In: Hammoudi, S., Śmiałek, M., Camp, O., Filipe, J. (eds) Enterprise Information Systems. ICEIS 2017. Lecture Notes in Business Information Processing, vol 321. Springer, Cham. https://doi.org/10.1007/978-3-319-93375-7_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-93375-7_15

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-93374-0

  • Online ISBN: 978-3-319-93375-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics