Introduction
In the modern era, software has become as indispensable to scientific discovery as the telescope or the test tube. Yet, despite its ubiquity, a significant gap exists between the importance of code in research and the formal training scientists receive to produce it. The 2013 paper, "Best Practices for Scientific Computing," serves as a foundational manifesto designed to bridge this divide. Drawing from the collective experience of the Software Carpentry project and empirical studies of software development, the authors provide a pragmatic roadmap for transitioning from "ad hoc" scripting to professional-grade scientific software engineering.
The "Software Gap" in Modern Science
The authors identify a systemic issue: while approximately 90% of scientists are primarily self-taught programmers, they spend upwards of 30% of their time developing software. This lack of formal training often results in buggy, unmaintainable code. In the high-stakes environment of academic publishing, these computational errors are not merely inconveniences; they have led to high-profile retractions in prestigious journals such as Science, Nature, and PNAS. The paper argues that a single error in a reused script can have "cascading impacts," potentially invalidating years of research across multiple laboratories.
Core Philosophy: Designing for Humans
A central insight of the paper is the shift in perspective from writing for machines to writing for people. The authors argue that because human working memory is limited, code must be structured to accommodate cognitive constraints:
- Chunking and Naming: Code should be broken into small, modular functions with meaningful names. This allows a reader—including the author’s "future self"—to understand the logic without having to hold dozens of disparate facts in their head simultaneously.
- The DRY Principle (Don't Repeat Yourself): Every piece of data and logic should have a single, authoritative representation. Copy-pasting code creates "code clones," where a bug fixed in one instance often persists in another, leading to silent failures.
- Defensive Programming: The authors advocate for the use of assertions—code that checks if a condition is true—as "executable documentation." These checks do more than catch errors; they explicitly communicate the programmer's assumptions to any future reader.
Technical Recommendations and Workflow
The paper distills decades of experience into 25 specific, actionable recommendations. Key highlights include:
1. Version Control
The authors recommend using a system like Git for every artifact created manually, including code, manuscripts, and raw data metadata. This ensures a complete, auditable history of the research process.
2. Automation and Testing
To ensure reproducibility, the paper suggests using build tools (such as Make) to automate workflows. This allows a single command to regenerate results from raw data. Furthermore, the use of off-the-shelf unit testing libraries is encouraged. By turning every discovered bug into a permanent test case, researchers can prevent regressions and build a robust suite of validations.
3. Optimization Strategy
A common pitfall in scientific computing is premature optimization in low-level languages like C++ or Fortran. The authors suggest a more efficient path: write in the highest-level language possible (such as Python or R) first. Only after the logic is proven correct should a researcher use a profiler to identify and optimize specific bottlenecks.
Collaboration and Knowledge Management
Scientific research is increasingly a team sport. The paper emphasizes the importance of pre-merge code reviews and issue trackers. These tools maintain a living "to-do" list and ensure that critical institutional knowledge is not lost when a student or postdoc leaves the lab.
Conclusion and Future Outlook
While the paper acknowledges that adopting all 25 practices at once can be intimidating, it encourages research groups to introduce these tools incrementally. The authors conclude that for computational science to achieve the same level of rigor as experimental disciplines, universities and funding agencies must prioritize training in these fundamental digital skills. "Best Practices for Scientific Computing" remains a vital guide for any researcher looking to make their work more reliable, reproducible, and impactful.
Summary updated