Towards assisting developers in API usage by automated recovery of complex temporal patterns

Abstract Context Despite the many advantages, the use of external libraries through their APIs remains difficult because of the usage patterns and constraints that are hidden or not properly documented. Existing work provides different techniques to recover API usage patterns from client programs in order to help developers use those libraries. However, most of these techniques produce patterns that generally do not involve temporal properties. Objective In this paper, we discuss the problem of temporal usage patterns recovery and propose an algorithm to solve it. We also discuss how the obtained patterns can be used at different stages of client development. Method We address the recovery of temporal API usage patterns as an optimization problem and solve it using a genetic-programming algorithm. Results Our evaluation on different APIs shows that the proposed algorithm allows to derive non-trivial temporal usage that are useful and generalizable to new API clients. Conclusion Recovering API usage temporal patterns helps client developers to use APIs in an appropriate way. In addition to potentially improve productivity, such patterns also helps preventing errors that result from an incorrect use of the APIs.

[1]  Hoan Anh Nguyen,et al.  Graph-based mining of multiple object usage patterns , 2009, ESEC/FSE '09.

[2]  Heather Goldsby,et al.  Automatically discovering properties that specify the latent behavior of UML models , 2010, MODELS'10.

[3]  Houari A. Sahraoui,et al.  Could We Infer Unordered API Usage Patterns Only Using the Library Source Code? , 2015, 2015 IEEE 23rd International Conference on Program Comprehension.

[4]  Chao Liu,et al.  Introduction to the special issue on program comprehension through dynamic analysis (PCODA) , 2008 .

[5]  Harold L. Somers,et al.  Review Article: Example-based Machine Translation , 1999, Machine Translation.

[6]  Houari A. Sahraoui,et al.  Visualization based API usage patterns refining , 2015, 2015 IEEE 3rd Working Conference on Software Visualization (VISSOFT).

[7]  Edmund M. Clarke,et al.  Counterexample-guided abstraction refinement , 2003, 10th International Symposium on Temporal Representation and Reasoning, 2003 and Fourth International Conference on Temporal Logic. Proceedings..

[8]  Bin Li,et al.  Mining Software Repositories for Automatic Interface Recommendation , 2016, Sci. Program..

[9]  Nissim Francez,et al.  Automatic Translation of Natural Language System Specifications into Temporal Logic , 1996 .

[10]  Jiawei Han,et al.  BIDE: efficient mining of frequent closed sequences , 2004, Proceedings. 20th International Conference on Data Engineering.

[11]  Zhendong Su,et al.  Javert: fully automatic mining of general temporal properties from dynamic traces , 2008, SIGSOFT '08/FSE-16.

[12]  Ciera Jaspan,et al.  Tricorder: Building a Program Analysis Ecosystem , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[13]  Martin P. Robillard,et al.  What Makes APIs Hard to Learn? Answers from Developers , 2009, IEEE Software.

[14]  Lu Zhang,et al.  Mining API Usage Examples from Test Code , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

[15]  Ivan Beschastnikh,et al.  Synergizing Specification Miners through Model Fissions and Fusions (T) , 2015, 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE).

[16]  Matthias Scheutz,et al.  What to do and how to do it: Translating natural language directives into temporal and dynamic logic representation for goal management and action execution , 2009, 2009 IEEE International Conference on Robotics and Automation.

[17]  Paulo Afonso Parreira Júnior,et al.  Detection Techniques of Dead Code: Systematic Literature Review , 2016, SBSI.

[18]  Thomas R. Gross,et al.  Automatic Generation of Object Usage Specifications from Large Method Traces , 2009, 2009 IEEE/ACM International Conference on Automated Software Engineering.

[19]  Houari A. Sahraoui,et al.  Towards the automated recovery of complex temporal API-usage patterns , 2018, GECCO.

[20]  Peter Thiemann,et al.  Interprocedural Analysis with Lazy Propagation , 2010, SAS.

[21]  Houari A. Sahraoui,et al.  Mining Complex Temporal API Usage Patterns: An Evolutionary Approach , 2017, 2017 IEEE/ACM 39th International Conference on Software Engineering Companion (ICSE-C).

[22]  Houari A. Sahraoui,et al.  A cooperative approach for combining client-based and library-based API usage pattern mining , 2016, 2016 IEEE 24th International Conference on Program Comprehension (ICPC).

[23]  Martin P. Robillard,et al.  Temporal analysis of API usage concepts , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[24]  George S. Avrunin,et al.  Patterns in property specifications for finite-state verification , 1999, Proceedings of the 1999 International Conference on Software Engineering (IEEE Cat. No.99CB37002).

[25]  Mira Mezini,et al.  Investigating Order Information in API-Usage Patterns: A Benchmark and Empirical Study , 2018 .

[26]  Ivan Beschastnikh,et al.  General LTL Specification Mining (T) , 2015, 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE).

[27]  Houari A. Sahraoui,et al.  Mining Multi-level API Usage Patterns , 2015, 2015 IEEE 22nd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[28]  D. Kebbal Automatic flow analysis using symbolic execution and path enumeration , 2006, 2006 International Conference on Parallel Processing Workshops (ICPPW'06).

[29]  Houari A. Sahraoui,et al.  An observational study on API usage constraints and their documentation , 2015, 2015 IEEE 22nd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[30]  Katsuro Inoue,et al.  Improving reusability of software libraries through usage pattern mining , 2018, J. Syst. Softw..

[31]  Manuvir Das,et al.  Perracotta: mining temporal API rules from imperfect traces , 2006, ICSE.

[32]  Hong Cheng,et al.  Searching connected API subgraph via text phrases , 2012, SIGSOFT FSE.

[33]  Anh Tuan Nguyen,et al.  GraPacc: A graph-based pattern-oriented, context-sensitive code completion tool , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[34]  Jian Pei,et al.  MAPO: Mining and Recommending API Usage Patterns , 2009, ECOOP.

[35]  Gabriele Bavota,et al.  Mining energy-greedy API usage patterns in Android apps: an empirical study , 2014, MSR 2014.

[36]  Pierre Poulin,et al.  Detection of Software Evolution Phases Based on Development Activities , 2015, 2015 IEEE 23rd International Conference on Program Comprehension.

[37]  Mira Mezini,et al.  Ieee Transactions on Software Engineering 1 Automated Api Property Inference Techniques , 2022 .

[38]  Leila Abdollahi Vayghan,et al.  Deploying Microservice Based Applications with Kubernetes: Experiments and Lessons Learned , 2018, 2018 IEEE 11th International Conference on Cloud Computing (CLOUD).

[39]  Houari A. Sahraoui,et al.  Identifying Software Components from Object-Oriented APIs Based on Dynamic Analysis , 2018, 2018 IEEE/ACM 26th International Conference on Program Comprehension (ICPC).

[40]  Zhendong Su,et al.  Online inference and enforcement of temporal properties , 2010, 2010 ACM/IEEE 32nd International Conference on Software Engineering.

[41]  Reid Holmes,et al.  Live API documentation , 2014, ICSE.