+ - 0:00:00
Notes for current slide
Notes for next slide

Friends don't let friends copy-paste

Preventing code rot

Frederik Aust & Marius Barth

21.04.2023

Preventing code rot

Preventing code rot

Recap

Computational reproducibility is hard!

Preventing code rot

Recap

Computational reproducibility is hard!

  • Shared reproducibility packages often fail
    (e.g., Eubank, 2016)

Preventing code rot

Recap

Computational reproducibility is hard!

  • Shared reproducibility packages often fail
    (e.g., Eubank, 2016)
  • Code is increasingly likely to break as time passes
    (it "rots")
    • This is true even if code is untouched

Preventing code rot

  • Computing environments inevitably change

Preventing code rot

  • Computing environments inevitably change
    • Installation or removal of software
    • Software updates
    • Removal or relocation of files
    • (Hardware updates)

Preventing code rot

  • Computing environments inevitably change
    • Installation or removal of software
    • Software updates
    • Removal or relocation of files
    • (Hardware updates)
  • Complex computing environments exacerbate the problem

Preventing code rot

Preventing code rot

  • Computational reproducibility requires a stable computing environment
  • But how?
    • Archive the computer used to run the analysis?
    • Trade-off between robustness and feasibility

Preventing code rot

  • Computational reproducibility requires a stable computing environment
  • But how?
    • Archive the computer used to run the analysis?
    • Trade-off between robustness and feasibility

Preventing code rot

  1. checkpoint by Microsoft
    • Requires a project-based workflow
    • Package database will gradually grow

Preventing code rot

  1. checkpoint by Microsoft
    • Requires a project-based workflow
    • Package database will gradually grow
  2. groundhog
    • Package database will gradually grow

Preventing code rot

  1. checkpoint by Microsoft
    • Requires a project-based workflow
    • Package database will gradually grow
  2. groundhog
    • Package database will gradually grow
  3. renv by RStudio
    • Most flexible and powerful
    • Least straight forward to use
    • No "forensic" applications

Preventing code rot

Preventing code rot

Dependencies are detected automatically

R script

library("checkpoint")
checkpoint("2022-04-27", r_version = "4.1.2")
library("ggplot2")

Console

checkpoint("2022-04-27")
install.packages("ggplot2")

Preventing code rot

Dependencies are detected automatically

R script

library("checkpoint")
checkpoint("2022-04-27", r_version = "4.1.2")
library("ggplot2")

Console

checkpoint("2022-04-27")
install.packages("ggplot2")







Uses a date-specific directory outside of usual library

~/.checkpoint/...

Preventing code rot

Preventing code rot





(✅)

Preventing code rot

Virtual machines

Preventing code rot

Containers

(Piccolo & Frampton, 2016)

Preventing code rot

  • Virtual machines (e.g., Vagrant)
    • Encapsulate an entire operating system
    • Require a lot of disk space
    • Take little longer to set up and boot

Preventing code rot

  • Virtual machines (e.g., Vagrant)
    • Encapsulate an entire operating system
    • Require a lot of disk space
    • Take little longer to set up and boot
  • Containers (e.g., Docker)
    • Widely used in software development
    • Depend on OS kernel, but can be run on all common operating systems

Preventing code rot







Preventing code rot

Preventing code rot

An unobtrusive Docker workflow for papaja

Time for a demonstration!

Preventing code rot

Summary

  • Computing environments inevitably change

Preventing code rot

Summary

  • Computing environments inevitably change
  • Robust computational reproducibility requires a fixed computing environment
    1. prevents code rot
    2. facilitates sharing reproducible analyses

Preventing code rot

Summary

  • Computing environments inevitably change
  • Robust computational reproducibility requires a fixed computing environment
    1. prevents code rot
    2. facilitates sharing reproducible analyses
  • Mind software licenses when sharing software environments

Preventing code rot

Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
oTile View: Overview of Slides
Esc Back to slideshow