Zen of Fortran

Mine probably need to percolate for a while (you had 11 years!). Apparently, Poets have a hard job. So far the best I think I did is

Grokking Fortran

Fast is better than slow
Slow is better than unmaintainable

Small functions are clearer than monolithic procedures
Simplicity is robustness
“Make everything as simple as possible – but no simpler” (Einstein)

Self-descriptive code is best
but comment

Make it look like the math

All inputs and outputs explicit
All inputs and outputs carefully named and clearly defined
the closer to the point of declaration the better
Be paranoid about parameters and check their validity coming and going

Array-oriented is better than object-oriented
Vector is better than loop
Matrix is better than vector
unless it’s complicated
Strided is better than scattered
Contiguous is better than strided
Broadcasting is a great idea
use where possible

Create tests large and small
and use them
Use every debug flag you have been given when developing

Write everything as if it was going to be reused
and share it
Package code and supporting files
like you were going to give them to a friend

“Rules are meant to be broken” (MacArthur, not Einstein)

     Based on:   "The Zen of Fortran", by Ondřej Čertík, John Pask
                 with poetic license taken by John S. Urban
     Date:       2021-10-30

     Inspired by Zen of Python 2 and Zen of NumPy 3,
     by Travis Oliphant and Tim Peters
2 Likes