Naming Conventions

I have some habits of naming variables and routines which I will outline in the following. This is of interest for you only if you try to understand the source codes.

Function Names

The names of all functions I write (and I mean ALL functions) begin with "mk". These are my initials, and this habit has been proven very useful, because I immediately see which routines are mine and which are from MatLab or other sources.

The names of almost all functions I wrote for LOCSMITH continue with "ls" to indicate that they are LOCSMITH functions. Exceptions are calendar and mapping routines and several routines which may easily be used outside the LOCSMITH package.

I never use under_scores and CamelCaseNames, because I find them distracting, difficult to read and write and a waste of screen space. I know that this is a somewhat unusual point of view, but that's how it is.

All names are lower case. The case sensitivity of MatLab, to me, is a reason NOT to use upper case and CamelCase, since these are a source of typos and thus syntax errors.

The routines of the LOCSMITH grid handler are named in a quite formal way to indicate the layered structure of this module. Names have the structure

  mklsgridsomething
  mklsgridsomethingtri
  mklsgridsomethingcart
  

with the following meaning:

MK
Routine written by Martin Knapmeyer
LS
part of the LOCSMITH package
GRID
part of the grid handler (or the grid evaluator)
SOMETHING
does something...
TRI
... with triangular grids
CART
... with cartesian grids.

Routines without suffix TRI or CART are dispatchers which call the grid specific routines.

Variable Names

There are several "standard" variable names I routinely use:

mygrid
The current search grid is usually contained in this.
indy, indies
"indy" typically denotes a single index into an array, "indies" is the plural form, denoting a list of indices. The name "indy" is not a shorthand for "Index", but was chosen in honor for the famous archaeologist
Dr. Henry "Indiana" Jones.
buffy
A buffer variable, used for buffering all kinds of contents, e.g. when swapping variables or reading from files. This name "buffy" is not a shorthand for "Buffer", but was chosen in honor of Buffy Anne Summers, Vampire Slayer.
cnt
A counter variable, often used in while loops to count the number of loopings.
*anz
The * is wildcard for some prefix. "anz" is from german "Anzahl" (number of things): this contains the number of entities in some thing, e.g. the number of elements in an array, the number of stations in a data file etc.
done
I have the sometimes bad habit of writing while loops like this:
 while done==0
  if stopcondition
   done=1;
  else
   whatever;
  end; % if condition
 end; % while
This allows to quit the loop at different places with different causes, but you don't see at once (in the while command itself) when the loop is stopped. (On the other hand, I never use "break" to quit a loop)
*lon
The * is wildcard for some prefix. Variables ending with "lon" usually contain longitude coordinates.
*lat
The * is wildcard for some prefix. Variables ending with "lat" usually contain latitude coordinates.
line
When reading ASCII files line by line, I store the current line in here.

eof.