Programming guidelines

As a programming RA, follow those tips to keep the pipeline clean!

Replicability

  • Make sure that the code can run on another computer:

    • If you are working from a git repo (which you should!): no reading or writing in a directory outside of the repo (therefore a local directory), except if it is a directory given as input

    • Always have all of your code available to everybody else; if it is not working yet, create and work on new git branch, then merge with master

    • At the end of your session, NOTHING should be available only on your machine; save and share the data/code as if every session was the very last one

    • When sharing a file, do not send a copy of this file, share a link to where it lives on GitHub or a path to the folder that contains the file on cloud storage

Human readability

  • Document your code

  • Assume that people will use/read/modify your code

  • Avoid hard-coded path; use arguments instead (may use hard-coded defaults)

  • Always assume that someone else will take over your project: explain your choices (of implementation, of default values, ...) in the comments, express your doubts/things that could be improved...

Tests (or at least sanity checks)

  • For each of your scripts, have really basic files to test them on, e.g. a 2-lines csv

  • List things that your output should have, then check really basic features: does the output file exist? is the number of lines correct?

Last updated