arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1812.04894cs.SE
收藏

A3:使用代码示例协助Android API迁移

A3: Assisting Android API Migrations Using Code Examples

Maxime Lamothe, Weiyi Shang, Tse-Hsun Chen

摘要:

Android API的快速发展给Android应用开发人员带来了挑战。为了利用Android频繁发布的API,开发人员必须经常在API迁移上花费大量精力。之前的研究和Android官方文档通常提供足够的信息来指导开发人员识别必须迁移的API调用以及更新版本的Android中相应的API调用(迁移什么)。然而,API迁移仍然是一项具有挑战性的任务,因为开发人员缺乏如何迁移API调用的知识。有一些代码示例(如Google Samples)可以说明API的用法。通过分析代码示例中API使用的变化,我们可以了解API迁移模式,以帮助开发人员进行API迁移。在本文中,我们提出了一种从代码示例中学习API迁移模式的方法,将这些模式应用于Android应用程序的API迁移源代码,并将结果作为潜在的迁移解决方案呈现给用户。为了评估我们的方法,我们通过从代码示例中学习API迁移模式来迁移开源Android应用程序中的API调用。我们发现,我们的方法可以成功地学习API迁移模式,并在80个案例中的71个案例中提供API迁移帮助。我们的方法可以迁移API调用,几乎不需要额外的修改,或者提供指导来帮助迁移。通过用户研究,我们发现采用我们的方法可以减少迁移API所花费的时间,平均减少29%。此外,我们与应用程序开发人员的访谈突出了我们在寻求API迁移时的方法的好处。我们的方法证明了利用软件存储库中包含的知识来促进API迁移的价值。

英文摘要:

The fast-paced evolution of Android APIs has posed a challenging task for Android app developers. To leverage Android's frequently released APIs, developers must often spend considerable effort on API migrations. Prior research and Android official documentation typically provide enough information to guide developers in identifying the API calls that must be migrated and the corresponding API calls in an updated version of Android (what to migrate). However, API migration remains a challenging task since developers lack the knowledge of how to migrate the API calls. There exist code examples, such as Google Samples, that illustrate the usage of APIs. We posit that by analyzing the changes of API usage in code examples, we can learn API migration patterns to assist developers with API Migrations. In this paper, we propose an approach that learns API migration patterns from code examples, applies these patterns to the source code of Android apps for API migration, and presents the results to users as potential migration solutions. To evaluate our approach, we migrate API calls in open source Android apps by learning API migration patterns from code examples. We find that our approach can successfully learn API migration patterns and provide API migration assistance in 71 out of 80 cases. Our approach can either migrate API calls with little to no extra modifications needed or provide guidance to assist with the migrations. Through a user study, we find that adopting our approach can reduce the time spent on migrating APIs, on average, by 29%. Moreover, our interviews with app developers highlight the benefits of our approach when seeking API migrations. Our approach demonstrates the value of leveraging the knowledge contained in software repositories to facilitate API migrations.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑