【24h】

How Swift Developers Handle Errors

机译:Swift开发人员如何处理错误

获取原文

摘要

Swift is a new programming language developed by Apple as a replacement to Objective-C. It features a sophisticated error handling (EH) mechanism that provides the kind of separation of concerns afforded by exception handling mechanisms in other languages, while also including constructs to improve safety and maintainability. However, Swift also inherits a software development culture stemming from Objective-C being the de-facto standard programming language for Apple platforms for the last 15 years. It is, therefore, a priori unclear whether Swift developers embrace the novel EH mechanisms of the programming language or still rely on the old EH culture of Objective-C even working in Swift. In this paper, we study to what extent developers adhere to good practices exemplified by EH guidelines and tutorials, and what are the common bad EH practices particularly relevant to Swift code. Furthermore, we investigate whether perception of these practices differs between novices and experienced Swift developers. To answer these questions we employ a mixed-methods approach and combine 10 semi-structured interviews with Swift developers and quantitative analysis of 78,760 Swift 4 files extracted from 2,733 open-source GitHub repositories. Our findings indicate that there is ample opportunity to improve the way Swift developers use error handling mechanisms. For instance, some recommendations derived in this work are not well spread in the corpus of studied Swift projects. For example, generic catch handlers are common in Swift (even though it is not uncommon for them to share space with their counterparts: non empty catch handlers), custom, developerdefined error types are rare, and developers are mostly reactive when it comes to error handling, using Swift's constructs mostly to handle errors thrown by libraries, instead of throwing and handling application-specific errors.
机译:Swift是一种由Apple开发的新编程语言,作为对象-c的替代品。它具有复杂的错误处理(EH)机制,提供了异常处理机制所提供的疑虑的分离,同时还包括提高安全性和可维护性的构造。然而,SWIFT还继承了Objective-C的软件开发文化,是过去15年来的Apple平台的De-Facto标准编程语言。因此,先验不清楚SWIFT开发人员是否拥抱编程语言的新型EH机制,或者仍然依靠Objective-C的旧EH文化甚至在SWIFT中工作。在本文中,我们研究开发人员在多大程度上遵守EH指南和教程的良好做法,以及与SWIFT代码特别相关的常见不良EH实践是什么。此外,我们调查了对新手和经验丰富的迅速开发人员之间对这些实践的看法。要回答这些问题,我们采用了混合方法方法,并将10个半结构化访谈结合了迅速开发人员,并从2,733个开源Github存储库中提取了78,760次Swift 4档的定量分析。我们的调查结果表明,有充分的机会改善Swift开发人员使用错误处理机制的方式。例如,在学习的Swift项目的语料库中,这项工作得出的一些建议并不易于扩展。例如,通用捕获处理程序在SWIFT中很常见(即使它们与他们的对应物共享空间并不罕见:非空捕获处理程序),自定义,DeveloperDefined误差类型很少,并且在错误时,开发人员大多是无反应性的处理,使用Swift的构造主要用于处理库抛出的错误,而不是抛出和处理特定于应用程序的错误。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号