Research Programming Guidelines

Richard Zanibbi, November 2011 (first draft)

This document summarizes my views on how to write code for research projects not concerned with large-scale software development. It is based on my experience writing code for my own as well as other people's research projects for more than a decade, in a number of different programming languages, development environments, and computing platforms. Comments are quite welcome (send email to: rxzvcs@rit.edu).


Summary

Correct is more important than fast.
Complete is more important than fast.
Clear and concise is more important than fast.
Get it right, then make it fast.

(Jim Cordy used to make the last point regularly. In cases with heavy iteration and/or large data one needs to optimize as a program is constructed, but this should be done incrementally, with 'right' modules/functions being constructed before they are modified and made 'fast.')

A year in the lab can save you a day in the library.

(paraphrased from Mike Kalish. Other people have probably worked on your problem or closely related ones. They will have written papers on their findings, and probably even made code available. Study their papers and programs, as it will save you time. Also, there is no substitute for learning through studying a program that has its purpose clearly understood by its author, with the structure of a problem and corresponding solution reflected in the program design, comments, and I/O.)
I think it is very definitely worth the struggle to try and do first-class work because the truth is, the value is in the struggle more than it is in the result.

(from Richard Hamming)

Guidelines