The evolution of type annotations in python: an empirical study

L. Grazia, Michael Pradel
{"title":"The evolution of type annotations in python: an empirical study","authors":"L. Grazia, Michael Pradel","doi":"10.1145/3540250.3549114","DOIUrl":null,"url":null,"abstract":"Type annotations and gradual type checkers attempt to reveal errors and facilitate maintenance in dynamically typed programming languages. Despite the availability of these features and tools, it is currently unclear how quickly developers are adopting them, what strategies they follow when doing so, and whether adding type annotations reveals more type errors. This paper presents the first large-scale empirical study of the evolution of type annotations and type errors in Python. The study is based on an analysis of 1,414,936 type annotation changes, which we extract from 1,123,393 commits among 9,655 projects. Our results show that (i) type annotations are getting more popular, and once added, often remain unchanged in the projects for a long time, (ii) projects follow three evolution patterns for type annotation usage -- regular annotation, type sprints, and occasional uses -- and that the used pattern correlates with the number of contributors, (iii) more type annotations help find more type errors (0.704 correlation), but nevertheless, many commits (78.3%) are committed despite having such errors. Our findings show that better developer training and automated techniques for adding type annotations are needed, as most code still remains unannotated, and they call for a better integration of gradual type checking into the development process.","PeriodicalId":68155,"journal":{"name":"软件产业与工程","volume":"143 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2022-11-07","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"4","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"软件产业与工程","FirstCategoryId":"1089","ListUrlMain":"https://doi.org/10.1145/3540250.3549114","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 4

Abstract

Type annotations and gradual type checkers attempt to reveal errors and facilitate maintenance in dynamically typed programming languages. Despite the availability of these features and tools, it is currently unclear how quickly developers are adopting them, what strategies they follow when doing so, and whether adding type annotations reveals more type errors. This paper presents the first large-scale empirical study of the evolution of type annotations and type errors in Python. The study is based on an analysis of 1,414,936 type annotation changes, which we extract from 1,123,393 commits among 9,655 projects. Our results show that (i) type annotations are getting more popular, and once added, often remain unchanged in the projects for a long time, (ii) projects follow three evolution patterns for type annotation usage -- regular annotation, type sprints, and occasional uses -- and that the used pattern correlates with the number of contributors, (iii) more type annotations help find more type errors (0.704 correlation), but nevertheless, many commits (78.3%) are committed despite having such errors. Our findings show that better developer training and automated techniques for adding type annotations are needed, as most code still remains unannotated, and they call for a better integration of gradual type checking into the development process.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
python中类型注释的演变:一个实证研究
在动态类型编程语言中,类型注释和渐进式类型检查器试图揭示错误并促进维护。尽管这些特性和工具是可用的,但目前还不清楚开发人员采用它们的速度有多快,采用时遵循什么策略,以及添加类型注释是否会暴露更多类型错误。本文首次对Python中类型注释和类型错误的演变进行了大规模的实证研究。该研究基于对1,414,936个类型注释更改的分析,这些更改来自9,655个项目中的1,123,393个提交。我们的结果表明:(i)类型注释越来越流行,一旦添加,通常在项目中保持很长一段时间不变;(ii)项目遵循三种类型注释使用的演变模式——常规注释、类型冲刺和偶尔使用——所使用的模式与贡献者的数量相关;(iii)更多的类型注释有助于发现更多的类型错误(相关性为0.704),但尽管有这些错误,仍然提交了许多(78.3%)。我们的研究结果表明,需要更好的开发人员培训和自动化技术来添加类型注释,因为大多数代码仍然没有注释,并且需要更好地将渐进式类型检查集成到开发过程中。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
676
期刊最新文献
Improving Grading Outcomes in Software Engineering Projects Through Automated Contributions Summaries GRADESTYLE: GitHub-Integrated and Automated Assessment of Java Code Style Improving Assessment of Programming Pattern Knowledge through Code Editing and Revision Designing for Real People: Teaching Agility through User-Centric Service Design Using Focus to Personalise Learning and Feedback in Software Engineering Education
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1