The quality of scientific code is a critical concern for the research community. Poorly written code can result in irreproducible results, incorrect findings, and slower scientific progress. In this study, we evaluate scientific code quality across three dimensions: reproducibility, readability, and reusability. We curated a corpus of 518 code repositories by analyzing Code Availability statements from all 1239 Nature publications in 2024. To assess code quality, we employed multiple methods, including manual attempts to reproduce Jupyter notebooks, documentation reviews, and analyses of code clones and mutation patterns. Our results reveal major challenges in scientific code quality. Of the 19 notebooks we attempted to execute, only two were reproducible, primarily due to missing data files and dependency issues. Code duplication was also common, with 326 clone classes of at least 10 lines and three instances found among 637 of the 1510 notebooks in our corpus. These duplications frequently involved tasks such as visualization, data processing, and statistical analysis. Moreover, our mutation analysis showed that scientific notebooks often exhibit tangled state changes, complicating comprehension and reasoning. The prevalence of these issues -- unreproducible code, widespread duplication, and tangled state management -- underscores the need for improved tools and abstractions to help science build reproducible, readable and reusable software.


翻译:科学代码质量是研究界关注的核心问题。编写低劣的代码可能导致结果不可复现、结论错误以及科学进展缓慢。本研究从可复现性、可读性和可重用性三个维度评估科学代码质量。通过分析2024年《自然》期刊所有1239篇出版物中的代码可用性声明,我们构建了包含518个代码仓库的语料库。为评估代码质量,我们采用多种方法:手动尝试复现Jupyter笔记本、文档审查,以及代码克隆与变异模式分析。研究结果揭示了科学代码质量面临的重大挑战:在尝试执行的19个笔记本中,仅有两个具备可复现性,主要原因在于数据文件缺失和依赖性问题。代码重复现象同样普遍,在1510个笔记本构成的研究语料库中,637个笔记本存在至少包含10行代码及3个实例的326个克隆类群。这些重复代码频繁涉及可视化、数据处理和统计分析等任务。此外,变异分析表明,科学笔记本常呈现状态变更混乱的特征,增加了理解与推理的难度。此类问题的普遍存在——不可复现代码、广泛重复与状态管理混乱——凸显出亟需改进工具与抽象方法,以助力科学界构建可复现、可读且可重用的软件。

0
下载
关闭预览

相关内容

数据质量维度的实践展开:一项综述
专知会员服务
20+阅读 · 2025年7月28日
编码计算研究综述
专知会员服务
22+阅读 · 2021年10月26日
专知会员服务
129+阅读 · 2021年6月23日
【干货书】计算机科学,647页pdf,Computer Science
专知会员服务
46+阅读 · 2021年5月10日
【干货书】数据科学手册,456页pdf
专知
15+阅读 · 2021年4月28日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Arxiv
0+阅读 · 4月26日
Arxiv
0+阅读 · 3月24日
VIP会员
相关主题
最新内容
驱动军事决策变革的顶尖人工智能指挥系统
专知会员服务
8+阅读 · 8月11日
非对称防御中的自组织临界性:俄乌战争
专知会员服务
10+阅读 · 8月10日
《战争中的大语言模型监管》
专知会员服务
14+阅读 · 8月10日
《边缘计算关键技术分析及美军作战实践应用》
边缘计算的军事应用
专知会员服务
12+阅读 · 8月9日
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员