Hungarian notation

From Wikiversity
(Redirected from Hungarian Notation)
Jump to navigation Jump to search

Hungarian notation is an identifier naming convention in which the name of variables, etc. have embedded information about their types or intended uses.


There are two "flavors" of Hungarian notation: Systems Hungarian and Apps Hungarian. Both contain type information, although the difference lies in whether we're interested in the actual data type, or simply the logical data type.

Systems Hungarian[edit]

Systems Hungarian notation encodes the actual data type. For example, "iNumChildren" for an integer value representing the number of one's children, or "cGrade" for a character value representing one's grade.

Apps Hungarian[edit]

Apps Hungarian notation encodes the logical data type. In other words, it gives meaning about the use or logical view of a variable, instead of the actual, physical type used. For instance, "rwPosition" could be a variable which indicates a particular row, perhaps with an integer value.

Some arguments can be made whether a variable's name falls under Systems or Apps Hungarian. For example, in C++ a variable named "sName", a string value representing a name, could be considered Apps Hungarian, as a string could be implemented using a character array. However, it could also mean that the actual data type is a string object. The distinction is not a particular important one so long as intended meaning is understood.

See also[edit]

Naming conventions (Programming)