Skip to main content

Semantics-Driven Learning for Microservice Annotations

  • Conference paper
  • First Online:
Service-Oriented Computing (ICSOC 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13740))

Included in the following conference series:

  • 2176 Accesses

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.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    https://bitbucket.org/semantics-driven-learning/replication-package/.

References

  1. 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)

    Google Scholar 

  2. 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)

    Google Scholar 

  3. 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)

    Google Scholar 

  4. 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)

    Google Scholar 

  5. 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)

    Google Scholar 

  6. 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)

    Google Scholar 

  7. 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)

    Google Scholar 

  8. Wang, W., et al.: Reinforcement-learning-guided source code summarization using hierarchical attention. IEEE Trans. Softw. Eng. 48(2), 102–119 (2022)

    Article  Google Scholar 

  9. 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)

    Google Scholar 

  10. 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)

    Google Scholar 

  11. 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)

    Google Scholar 

  12. 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)

    Google Scholar 

  13. Zhang, M., et al.: An empirical study of boosting spectrum-based fault localization via pagerank. IEEE Trans. Softw. Eng. 47(6), 1089–1113 (2021)

    Article  MathSciNet  Google Scholar 

  14. 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)

    Google Scholar 

  15. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Yuqun Zhang .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics