Writing clean scientific software for plasma simulation
Description
Most scientific programmers are self-taught. Graduate programs in plasma physics often lack courses on scientific programming, which leaves students to learn these skills on their own. High pressure to get results prevents us from taking the time to learn practices from software engineering that can greatly improve the reliability, maintainability, and usability of software. Adopting such practices can make research more efficient and reliable, improve scientific reproducibility, and prevent future headaches. Writing readable code is particularly important because code is communication. I will discuss strategies for writing clean scientific code such as choosing meaningful variable names, refactoring code for readability in preference to commenting on how it works, and writing short functions that do exactly one thing. I will describe techniques such as periodic refactoring, continuous integration testing, test-driven development, and layering code at different levels of abstraction. I will describe how these techniques and strategies can be applied to plasma simulation software.
Notes
Files
DPP2019_CleanCode.pdf
Files
(179.7 kB)
Name | Size | Download all |
---|---|---|
md5:206df3d3e3faa24756d3c87f6d88a470
|
179.7 kB | Preview Download |
Additional details
Related works
- Is source of
- Presentation: 10.5281/zenodo.3922956 (DOI)
Funding
- Collaborative Research: Frameworks: An open source software ecosystem for plasma physics 1931388
- U.S. National Science Foundation
References
- Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, Design Patterns: Elements of Reusable Object‑Oriented Software (1995, Addison-Wesley)
- Robert C. Martin, Clean Code: A Handbook of Agile Software Craftsmanship (2009, Prentice Hall)
- Robert C. Martin, Clean Architecture: A Craftsman's Guide to Software Structure and Design (2018, Prentice Hall)
- Greg Wilson, D. A. Aruliah, C. Titus Brown, Neil P. Chue Hong, Matt Davis, Richard T. Guy, Steven H. D. Haddock, Kathryn D. Huff, Ian M. Mitchell, Mark D. Plumbley, Ben Waugh, Ethan P. White, and Paul Wilson (2014), Best Practices for Scientific Computing, PLOS Biology, 12, e1001745, https://doi.org/10.1371/journal.pbio.1001745