Abstract
Annotations are program metadata that generates code and configuration files, among others. Different frameworks provide annotations to facilitate the implementation of microservice applications while their absence can slow down the maintenance of microservices and their misuse can lead to potential bugs. In this paper, we propose a novel semantics-driven learning approach for capturing the relation between code fragments and annotations, leveraging a Recurrent Neural Network (RNN) and a K-Nearest-Neighbour (KNN) classifier. The approach locates similar pieces of code to increase the probability of suggesting annotations of unseen fragments. We utilise PyTorch and Sci-kit Learn to evaluate our approach with a set of Java code fragments, and we measure how similar two code fragments are by a number between zero (close) and one (distant). The results indicate that our semantics-driven learning framework achieves an average of 87% of correct recommendations of annotations when the code fragments have a distance of 0.4 against the expected annotations subset.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Dam, H.K., et al.: Lessons learned from using a deep tree-based model for software defect prediction in practice. In: Proceedings of the IEEE/ACM 16th International Conference on Mining Software Repositories (MSR 2019), pp. 46–57. IEEE (2019)
Hu, X., et al.: Deep code comment generation. In: Proceedings of the 26th Conference on Program Comprehension (ICPC 2018), pp. 200–210. ACM Press (2018)
Liang, G., et al.: Automatic construction of an effective training set for prioritizing static analysis warnings. In: Proceedings of the IEEE/ACM International Conference on Automated Software Engineering (ASE 2010), pp. 93–102. ACM (2010)
Perez, D., Chiba, S.: Cross-language clone detection by learning over abstract syntax trees. In: Proceedings of the 16th International Conference on Mining Software Repositories (MSR 2019), pp. 518–528. IEEE (2019)
Pigazzini, I.: Automatic detection of architectural bad smells through semantic representation of code. In: Proceedings of the 13th European Conference on Software Architecture (ECSA 2019), pp. 59–62. ACM (2019)
Pigazzini, I., Fontana, F.A., Lenarduzzi, V., Taibi, D.: Towards microservice smells detection. In: Proceedings of the 3rd International Conference on Technical Debt (TechDebt 2020), pp. 92–97. ACM (2020)
Pinheiro, P., et al.: Mutation operators for code annotations. In: Proceedings of the III Brazilian Symposium on Systematic and Automated Software Testing (SAST 2018), pp. 77–86. ACM (2018)
Wang, W., et al.: Reinforcement-learning-guided source code summarization using hierarchical attention. IEEE Trans. Softw. Eng. 48(2), 102–119 (2022)
Yao, Z., Peddamail, J.R., Sun, H.: Coacor: code annotation for code retrieval with reinforcement learning. In: Proceedings of the the World Wide Web Conference (WWW 2019), pp. 2203–2214 (2019)
Yu, H., et al.: Neural detection of semantic code clones via tree-based convolution. In: Proceedings of the 27th International Conference on Program Comprehension (ICPC 2019), pp. 70–80. IEEE (2019)
Zeng, Z., Zhang, Y., Zhang, H., Zhang, L.: Deep just-in-time defect prediction: how far are we? In: ISSTA 2021: 30th ACM SIGSOFT International Symposium on Software Testing and Analysis, Virtual Event, Denmark, 11–17 July 2021, pp. 427–438. ACM (2021)
Zhang, J., et al.: A novel neural source code representation based on abstract syntax tree. In: Proceedings of the 41st International Conference on Software Engineering (ICSE 2019), pp. 783–794. IEEE (2019)
Zhang, M., et al.: An empirical study of boosting spectrum-based fault localization via pagerank. IEEE Trans. Softw. Eng. 47(6), 1089–1113 (2021)
Zhou, Y., Gu, R., Chen, T., et al.: Analyzing APIs Documentation and Code to Detect Directive Defects. In: Proceedings of the 39th International Conference on Software Engineering (ICSE 2017). pp. 27–37. IEEE Press (2017)
Zilberstein, M., Yahav, E.: Leveraging a corpus of natural language descriptions for program similarity. In: Proceedings of the ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward! 2016), pp. 197–211. ACM (2016)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Ramírez, F., Mera-Gómez, C., Chen, S., Bahsoon, R., Zhang, Y. (2022). Semantics-Driven Learning for Microservice Annotations. In: Troya, J., Medjahed, B., Piattini, M., Yao, L., Fernández, P., Ruiz-Cortés, A. (eds) Service-Oriented Computing. ICSOC 2022. Lecture Notes in Computer Science, vol 13740. Springer, Cham. https://doi.org/10.1007/978-3-031-20984-0_17
Download citation
DOI: https://doi.org/10.1007/978-3-031-20984-0_17
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-20983-3
Online ISBN: 978-3-031-20984-0
eBook Packages: Computer ScienceComputer Science (R0)