Johnny's IDL Style Guide


This style guide describes coding conventions I am adhering to (albeit with mixed sucess) starting 28 Jan 2000. Last updated 20 Jun 2001.

Function Layout

Function names (in calls and function definition lines) are in all-caps. In commenting, I try to follow the same convention, though sometimes I forget to do so.

Keyword Layout

Keyword names (in calls) have their first letter capitalized. No other letters are capitalized, unless it's the first letter after an underscore, which is usually capitalized (since I interpret the underscore as a space separating two major words), or the first letter after a single-letter descriptor letter like "X". Note that if it's a single letter "word" (e.g. for the index "i") before or after the underscore, that letter isn't capitalized. Thus, for example: As of 12 Feb 2001, in procedure definition lines, keywords are all capitalized, as they are also in the first occurrence in the keywords section of the commenting block. However, in other commenting, capitalization follows the above convention.

Procedure Layout

Procedure names (in calls and procedure definition lines) are in all-caps. In commenting, I try to follow the same convention, though sometimes I forget to do so.

Reserved Words Layout

Reserved words are all in lowercase.

Variable Layout

Variables are all in lowercase. An exception is variables that will specify array dimensions, which are often all capitalized (e.g. NX, NT).

Generally, no type information is described by variable names. However, if the second letter of a variable is capitalized, while the first is not, there is a good chance that the first letter of the variable name does describe type, using conventions from the Interactive Visuals Coding Style Guide.

Variables through which values are passed in or out of a procedure or function are usually prefixed "in_" or "out_", depending on whether the variable passes information in to (or out of) the procedure. This is done to help identify which variables the procedure communicates through, and to protect input variables I don't wish to be changed by the procedure; in the procedure, a copy of the input/output variable is usually the variable name with the "in_" or "out_" prefix stripped off.

Prior to 24 Jul 2000: System variables are also in lowercase, except the first letter after a period (which denotes structure) is capitalized, as is the first letter after the exclamation mark.

24 Jul 2000: System variables are all capitalized.

Return to IDL Library. <email address>. Usage and disclaimer notice.