Abstract
Reusing existing class libraries can improve the productivity of software development. API usage patterns are useful resources for programmers in reusing class libraries. Existing approaches often exploit API graphs to model semantic relations between API elements of class libraries, and traversal graphs to capture API usage patterns. However, those approaches cannot describe the number of parameters and the number of overload methods, and may not search for various API usage patterns. In this paper, we propose an automatic and complete approach to searching for API usage patterns by model checking technique. We introduce a novel kind of API transition system model to completely describe the relations between all API elements of existing class libraries. We obtain API usage constraints from queries, namely the numbers and types of input and output objects and class types transformed based on APIs replacement model, and give the logical characterizations of the constraints by suitable CTL* (computation tree logic) formulas. Then, we can obtain suitable API usage patterns by model checking the logical formulas in related API transition system models based on model checker NuSMV. The experiments indicate that, in contrast to existing approaches, our approach can automatically and effectively search for various API usage patterns.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Osvaldo, S.S., Lopes, D., Silva, A.C., et al.: Developing software systems to big data platform based on mapreduce model: an approach based on model driven engineering. Inf. Soft. Tech. 7(6), 30–48 (2017)
Mkitalo, N., Taivalsaari, A., Kiviluoto, A., et al.: On opportunistic software reuse. Computing 10(2), 2385–2408 (2020)
Desouza, K.C., Awazu, Y., Tiwana, A.: Four dynamics for bringing use back into software reuse. Commun. ACM 49(1), 96–100 (2015)
Shen, Q., Wu, S., Zou, Y., et al.: From API to NLI: a new interface for library reuse. J. Syst. Softw. 169(110), 7–28 (2020)
Kula, R.G., German, D.M., Ouni, A., et al.: Do developers update their library dependencies. Empir. Softw. Eng. 4(23), 384–417 (2018)
Zhong, H., Mei, H.: An empirical study on API usages. IEEE Trans. Softw. Eng. 45(4), 319–334 (2019)
Saied, M.A., Sahraoui, H., Dufour, B.: An observational study on API usage constraints and their documentation. In: 2015 IEEE 22nd International Conference on Software Analysis, Evolution, and Reengineering (SANER). IEEE, pp. 33–42 (2015)
Niu, H., Keivanloo, I., Zou, Y., et al.: API usage pattern recommendation for software development. J. Syst. Softw. 12(9), 127–139 (2017)
Dit, B., Revelle, M., Gethers, M., et al.: Feature location in source code: a taxonomy and survey. J. Softw. Maint. Evol. Res. Pract. 25(1), 53–95 (2013)
Saied, M.A., Benomar, O., Abdeen, H., et al.: Mining multi-level API usage patterns. In: 2015 IEEE 22nd International Conference on Software Analysis, Evolution, and Reengineering (SANER). IEEE, pp. 23–32 (2015)
Zhong, H., Xie, T., Zhang, L., et al.: MAPO: mining and recommending API usage patterns. Proc Ecoop 56(53), 318–343 (2009)
Mendez, D., Baudry, B., Monperrus, M.: Empirical evidence of large-scale diversity in API usage of objected-oriented software. In: Proceedings of 13th IEEE International Working Conference on Source Code Analysis and Manipulation (SCAM), pp. 43–52 (2013)
Mandelin, D., Xu, L., Bodik, R., et al.: Jungloid mining: helping to navigate the API jungle. Program. Lang. Des. Implementation, ACM Sigplan Not. 40(6), 48–61, (2005)
Thummalapenta, S., Xie, T.: Parseweb: a programmer assistant for reusing open source code on the web. In: Proceeding soft the twenty-second IEEE/ACM international conference on Automated software engineering. ACM, New York, pp. 204–213 (2007)
Nguyen, A.T., Nguyen, H.A., Nguyen, T.T., et al.: GraPacc: a graph-based pattern-oriented, context-sensitive code completion tool. In: International Conference on Software Engineering. IEEE, NJ, 1407–1410 (2012)
Chen, L., Jiang, W., Songlin, H.: An API recommendation system based on a new graph model. Chin. J. Comput. 395(11), 2172–2187 (2015)
Reps, T.W., et al.: Component-based synthesis for complex APIs. In: POPL 2017. ACM, pp. 15–21 (2017)
Kaile, S., Abdul, S., Xiangyu, L.: Model checking temporal logics of knowledge via OBDDs1. Comput. J. (4), 403–420
Agha, G., Palmskog, K.: A survey of statistical model checking. ACM Trans. Model. Comput. Simul. 28(1), 1–39 (2018)
Gol, E.A., Bartocci, E., Belta, C.: A formal methods approach to pattern synthesis in reaction diffusion systems. Eprint Arxiv 20(15), 108–113 (2014)
Cappart, Q., Limbree, C., Schaus, P., et al.: Dependability analysis of control systems using systemC and statistical model checking. Comput. Sci. 20(18), 61–68 (2016)
Raghothaman, M., Wei, Y., Hamadi, Y.: SWIM: Synthesizing what I mean. In: Proceedings of the 38th International Conference on Software Engineering (ICSE), IEEE, pp. 357–367 (2016)
Gu, X., Zhang, H., Zhang, D., et al.: Deep API learning. In: Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering. ACM, pp. 13–18 (2016)
Beek, M.H., Fantechi, A., Gnesi, S., et al.: Modelling and analysing variability in product families: Model checking of modal transition systems with variability constraints. J. Logic Algebraic Program. 85(2), 287–315 (2016)
Khamespanah, E., Khosravi, R., Sirjani, M.: An efficient TCTL model checking algorithm and a reduction technique for verification of timed actor models. Sci. Comput. Program. 153(15), 1–29 (2018)
Camilli, M., Bellettini, C., Capra, L., Monga, M.: CTL model checking in the cloud using MapReduce. In: 16th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing, IEEE, pp. 333–340 (2014)
Bozzano, M., Cimatti, A., Lisagor, O., et al.: Safety assessment of AltaR9ica models via symbolic model checking. Ence Comput. Program. 98(4), 464–483 (2015)
Nie, L., Jiang, H., Ren, Z., et al.: Query expansion based on crowd knowledge for code search. IEEE Trans. Serv. Comput. 9(5), 771–783 (2017)
Stolee, K.T., Elbaum, S., Dobos, D.: Solving the search for source code. ACM Trans. Softw. Eng. Methodol. (TOSEM) 23(3), 26–67 (2014)
Stolee, K.T., Elbaum, S., Dwyer, M.B.: Code search with input/output queries: generalizing, ranking, and assessment. J. Syst. Softw. 116(4), 35–48 (2016)
Acknowledgements
We are very grateful to the editors and reviewers for their comments on this manuscript. This work was supported by the National Natural Science Foundation of China under Grant 61672384, the Ningbo Natural Science Foundation of China (Grant No. 2019A610088), the Open Subject of Key Laboratory of Embedded and Service Computing of Ministry of Education of China (Grant No. ESSCKF 2019–07).
Author information
Authors and Affiliations
Corresponding authors
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this paper
Cite this paper
Ding, Xe., Niu, J., Wang, J. (2021). API Usage Pattern Search Based on Model Checking. In: Qin, S., Woodcock, J., Zhang, W. (eds) Dependable Software Engineering. Theories, Tools, and Applications. SETTA 2021. Lecture Notes in Computer Science(), vol 13071. Springer, Cham. https://doi.org/10.1007/978-3-030-91265-9_16
Download citation
DOI: https://doi.org/10.1007/978-3-030-91265-9_16
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-91264-2
Online ISBN: 978-3-030-91265-9
eBook Packages: Computer ScienceComputer Science (R0)