Skip to main content
Printer-friendly version

Now consider a simple statement like:


In the all caps keyword form, the variable almost disappears. Converting case we get:

if not Ans then do:

And, adding the Hungarian prefix we get:

if not llg_Ans then do:

In this case, we certainly would have guessed that Ans must have been a logical variable or it wouldn’t compile, but the “llg_” prefix tells us that it is a local variable scoped to the procedure, which tells us a great deal about where it might be assigned a value. For example, suppose a block of code like:

if lch_Type = “C” then do:
update llg_Ans with frame fr_Decision.
if not llg_Ans then do:

In a case like this, we can see that the value of llg_Ans might come from the update, but it might come from somewhere else. Consider what a different set of information this is than if the name of the variable was iplg_Ans, telling us that it was an input parameter and therefore its initial value came from outside the procedure. One prefix tells us to look to variable definitions for default values, the other to the calling program.

One of the classic values of this type of notation is the ability to have two otherwise identical variable names that are of different type. E.g, ctt_Invoice and chn_Invoice, the former a temp-table scoped to a class and the latter a handle to that temp-table, also scoped to the class. Or, lin_Quantity and lch_Quantity where the former is the variable used in computations and the latter is the form used in displays to allow special handling for units of measure.

To the programmer who has spent the last 10 years reading nothing but upper case keyword code, probably even the lower case keyword code looks funny, much less something with underscores and strange letters hanging out in front. But, work with code that way for a while and it becomes expected, normal … and useful. I personally was opposed to this sort of notation until I was persuaded of its advantages and now that I am used to it, I would leave it behind only very reluctantly.

Next Page