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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 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.
We used OCEAN in our previous work to automate the detection of code smells.
- 3.
- 4.
- 5.
Assertional Box.
- 6.
Terminological Box.
- 7.
- 8.
- 9.
- 10.
- 11.
We called such developers ‘code smells propagators’.
- 12.
The name of the developer was blurred out for privacy.
- 13.
- 14.
All prefixes of referenced ontologies has been shortened to better fit in article’s page.
- 15.
- 16.
Details about how to use our ontologies and tools can be found at: https://github.com/luispscarvalho/resys/wiki.
References
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)
Lu, J., Wu, D., Mao, M., Wang, W., Zhang, G.: Recommender system application developments: a survey. Decis. Support Syst. 74, 12–32 (2015)
Fraihat, S., Shambour, Q.: A framework of semantic recommender system for e-Learning. J. Softw. 10(3), 317–330 (2015)
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)
Montuschi, P., Lamberti, F., Gatteschi, V., Demartini, C.: A semantic recommender system for adaptive learning. IEEE IT Professional 17(5), 50–58 (2015)
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)
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)
Emden, V., Leon, M.: Java quality assurance by detecting code smells. In: 9th Working Conference on Reverse Engineering, pp. 97–106. IEEE Press (2002)
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)
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)
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)
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)
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)
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)
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)
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
Fowler, Ma., Kent, B.: Refactoring: Improving the Design of Existing Code. Addison-Wesley Professional, Reading (1999)
Author information
Authors and Affiliations
Corresponding authors
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2018 Springer International Publishing AG, part of Springer Nature
About this paper
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)