Skip to content

Instantly share code, notes, and snippets.

@joezuntz
Last active September 25, 2017 11:29
Show Gist options
  • Save joezuntz/3380452 to your computer and use it in GitHub Desktop.
Save joezuntz/3380452 to your computer and use it in GitHub Desktop.
Programming maxims for new phd students
Here are some short programming maxims for new science PhD students, to correct the most egregious errors made by people
trained in science but not in programming. Some from http://www.theexclusive.org/2012/08/principles-of-research-code.html and http://arkitus.com/PRML/
- There is no tax on variable name length - make them as long as you like.
- People will come to your code not knowing your nomenclature.
- Don't write programs, write functions.
- Don't write functions, write libraries.
- Don't use code from Numerical Recipes.
- Separate the input and output parts of your code from the calculations.
- With very few exceptions, don't use global variables.
- Collect together variables that are usually passed around together into a single object.
- Don't write your own linear algebra - use Lapack.
- Don't write your own Fourier Transforms - use FFTW.
- Your product is not code. Your product is knowledge...
- unless you are very successful.
- Reproducing a figure from your paper should be a single command line call.
- If you don't use version control you're insane.
- If you are using random numbers, have the option to set your seed for repeatability.
- Separate your code and data.
- Separate your input and output data.
- Use checkpointing.
- Don't invent your own file formats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment