Skip to main content
Printer-friendly version

The use of any form of Hungarian Notation is a topic certain to produce intense opinions, whether pro or con. Since CI intends to use a form of Hungarian Notation in its published examples and foundation classes, it seems worthwhile to review the reasons for this choice and the specifics of the standards that will be used.

Originally, Hungarian Notation was described by Charles Simonyi, a senior engineer at Xerox and later Microsoft. Since then, there have been many alternate variations on his core idea, some of which are rather different from the original intent. The core notion of Hungarian Notation is to apply a prefix to names in order to help identify “type”. In the original formulation, later known as Apps Hungarian, the “type” was meant to be an indication of the variable’s use or purpose. Subsequently, another major family of notation developed which is referred to as Systems Hungarian in which the “type” is intended to be a datatype. See http://en.wikipedia.org/wiki/Hungarian_notation for more discussion of the historical background.

The formalization used by CI, which is derived from one proposed a number of years ago by Peter Headland, extends the concept of “type” to include “direction” and “scope”. “Direction” applies only to parameters and indicates whether the parameter is input, output, or input-output with respect to its context. “Scope” indicates the applicable scope of the variable. These three aspects combine to give one a significant amount of information about any particular variable without having to search for definitions and other references. It is believed that this very limited extension of type avoids the issues associated with systems using an open-ended extension of characteristics such as:

a_crszkvc30LastNameCol : constant reference function argument, holding contents of a database column of type varchar(30) called LastName that was part of the table's primary key (example from the Wikipedia entry above).

In the CI formalization, the first character, which can be missing, is always direction, the second always scope (missing for database tables and fields), and the third and fourth indicate the type, so the prefix is limited to two to four characters from a well-defined set (chart provided at the end).

Next Page or download PDF below.

AttachmentSize
Hungarian.pdf76.35 KB