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会员
相关主题
最新内容
无人机自主控制与人工智能:系统性综述
专知会员服务
3+阅读 · 今天7:25
巡飞弹与反无人机系统——现代战场的两大支柱
专知会员服务
1+阅读 · 今天6:54
《打造“黄金舰队”》57页报告
专知会员服务
1+阅读 · 今天6:52
《北约数字教官网络发展路径》128页报告
专知会员服务
1+阅读 · 今天6:33
ECCV 2026 | MIMFlow:MIM与归一化流统一图像生成
专知会员服务
6+阅读 · 6月25日
网状网络及其在军事领域的运用
专知会员服务
7+阅读 · 6月25日
无美国参与的欧洲战争方式(万字长文)
专知会员服务
8+阅读 · 6月25日
《国防领域敏感性分析白皮书》
专知会员服务
9+阅读 · 6月25日
综述 | 从问答到任务完成:Agent系统与Harness设计
Agentic RL:框架、实践与长程智能体训练
专知会员服务
10+阅读 · 6月24日
相关基金
国家自然科学基金
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会员