GEOL 5470 Humphrey
This is paraphrased from Taras Gerya, Intro to Numerical Geodynamic modelling.
Coding Rules
1 Think before programming. You must have a clear algorithm in your mind before you start pounding keys
2 Comment everything. Your code should have more lines of comments than code!
3 Programming means making buggy code, which means that coding is really debugging. Typically you will spend 1% of your time coding and 99% debugging.
4 The most difficult bugs are the trivial ones. Indexing errors (X[j] instead of X[n]), sign errors (x+y instead of x-y), order of mag errors ( 0.003 instead of 0.03)
5 Anything strange in the output is the result of a bug. (No the computer didn’t make a mistake!)
6 A single bug can ruin 1000s of lines of elegant code. You have to test your code to find that bug.
7 Buggy code can produce realistic and pretty output. You must know what you are expecting, just because it is beautiful, doesn’t mean it is correct.
8 Bug free code is the goal that we strive towards, but rarely completely achieve.