arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1704.00778cs.SEcs.PL
收藏

异常处理反模式的流行性研究

Studying the Prevalence of Exception Handling Anti-Patterns

Guilherme B. de Pádua, Weiyi Shang

摘要:

现代程序设计语言,如Java和C#,通常提供处理异常的功能。这些功能将错误处理代码与常规源代码分开,并被证明可以增强软件可靠性,理解和维护的实践。尽管已经认识到异常处理功能的优点,但滥用它们仍然可能导致灾难性的软件故障,例如应用程序崩溃。之前的研究提出了异常处理的反模式;但人们对这些反模式的普遍性知之甚少。在本文中,我们调查异常处理反模式的流行程度。我们使用自动异常流分析工具从16个开源Java和C#库和应用程序中收集了一个完整的异常反模式列表。我们发现,尽管异常处理反模式广泛存在于我们所有的主题中,但只有少数反模式(例如,未处理的错误、Catch Generic、Unreachable错误、Over-catch和破坏性包装)可以被普遍识别。另一方面,我们发现反模式的流行说明了C#和Java之间的差异。我们的研究结果需要进一步深入分析不同语言的异常处理实践。

英文摘要:

Modern programming languages, such as Java and C#, typically provide features that handle exceptions. These features separate error-handling code from regular source code and are proven to enhance the practice of software reliability, comprehension, and maintenance. Having acknowledged the advantages of exception handling features, the misuse of them can still cause catastrophic software failures, such as application crash. Prior studies suggested anti-patterns of exception handling; while little knowledge was shared about the prevalence of these anti-patterns. In this paper, we investigate the prevalence of exception-handling anti-patterns. We collected a thorough list of exception anti-patterns from 16 open-source Java and C# libraries and applications using an automated exception flow analysis tool. We found that although exception handling anti- patterns widely exist in all of our subjects, only a few anti- patterns (e.g. Unhandled Exceptions, Catch Generic, Unreachable Handler, Over-catch, and Destructive Wrapping) can be commonly identified. On the other hand, we find that the prevalence of anti- patterns illustrates differences between C# and Java. Our results call for further in-depth analyses on the exception handling practices across different languages.

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

↑