What is good scientific code?#

re-runnable, repeatable, reproducible, reusable, and replicable.

“The code should be executable (re-runnable) and produce the same result more than once (repeatable); it should allow an investigator to reobtain the published results (reproducible) while being easy to use, understand and modify (reusable), and it should act as an available reference for any ambiguity in the algorithmic descriptions of the article (replicable).” (Benureau & Rougier, 2018)

What is the difference between reproducible and replicable science?#

Reproducing#

the result of a computation means running the same software on the same input data and obtaining the same results. (Benureau & Rougier, 2018)

Replicating#

a published result means writing and then running new software based on the description of a computational model or method provided in the original publication, and obtaining results that are similar enough to be considered equivalent. (Benureau & Rougier, 2018)

But there are different opinions on this definition (Plesser, 2018)

What are the benefits of having good scientific code?#

  • Transparency in the scientific process, as anyone including the general public can access the data, methods, and results.

  • Ease of replication and extension of your work by others, which further supports peer review and collaborative learning in the scientific community.
    → Avoiding paper retractions due to computation bugs
    → Code is increasingly more required for journal review (e.g. o2r Project)

  • You can easily understand and re-run your own analyses as often as needed and after time has passed.

How to write “good scientific code”?#

Here are some guidelines from Wilson et al. (2014) and Wilson et al. (2018):

  1. Write programs for people, not computers.

  2. Let the computer do the work.

  3. Make incremental changes.

  4. Don’t repeat yourself (or others).

  5. Plan for mistakes.

  6. Optimize software only after it works correctly

  7. Document design and purpose, not mechanics.

  8. Collaborate.