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

移动App开发中异常处理代码的推荐

Recommendation of Exception Handling Code in Mobile App Development

Tam The Nguyen, Phong Minh Vu, Tung Thanh Nguyen

摘要:

在现代程序设计语言中,异常处理是避免意外运行时错误的有效机制。因此,未能捕获和处理异常可能会导致严重的问题,如系统崩溃、资源泄漏或负面的最终用户体验。然而,在移动应用程序开发中,编写正确的异常处理代码通常具有挑战性,这是由于移动应用程序的API库的快速变化特性以及其文档和源代码示例的不足。我们之前的研究表明,在实践中,移动应用程序开发人员会导致许多与异常相关的错误,并且仍然使用糟糕的异常处理实践(例如,捕获异常并不做任何事情)。为了解决这些问题,在本文中,我们介绍了两种新的技术,建议正确的异常处理代码。一种技术XRank推荐代码来捕获可能发生在代码段中的异常。另一个是XHand,它为这种发生的异常推荐了更正代码。我们开发了ExAssist,一个使用XRank和XHand进行异常处理的代码推荐工具。实证评估表明,我们的技术是非常有效的。例如,XRank的top-1准确率为70%,top-3准确率为87%。XHand的结果分别为89%和96%。

英文摘要:

In modern programming languages, exception handling is an effective mechanism to avoid unexpected runtime errors. Thus, failing to catch and handle exceptions could lead to serious issues like system crashing, resource leaking, or negative end-user experiences. However, writing correct exception handling code is often challenging in mobile app development due to the fast-changing nature of API libraries for mobile apps and the insufficiency of their documentation and source code examples. Our prior study shows that in practice mobile app developers cause many exception-related bugs and still use bad exception handling practices (e.g. catch an exception and do nothing). To address such problems, in this paper, we introduce two novel techniques for recommending correct exception handling code. One technique, XRank, recommends code to catch an exception likely occurring in a code snippet. The other, XHand, recommends correction code for such an occurring exception. We have developed ExAssist, a code recommendation tool for exception handling using XRank and XHand. The empirical evaluation shows that our techniques are highly effective. For example, XRank has top-1 accuracy of 70% and top-3 accuracy of 87%. XHand's results are 89% and 96%, respectively.

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

↑