Hungarian notation

It was named after the Hungarian notation in ( English ) program text exotic look of constructions brought about by certain rules identifier and the Hungarian origin of its inventor Charles Simonyi.

Developed by Simonyi convention (Excel, Word, etc.) applied to Microsoft in the Application Group with great success and in the wake of the Systems Group ( Windows) adopted, whereby there was a fundamental misunderstanding. Simonyi said in his paper on the "type" of a variable, which has been widely interpreted as a " data type". Rather refers to the type of variables in the specific context of an application. It is not so much whether a variable integer or decimal number, but if there is a counter, a coordinate on screen to create an index in an array or similar

Charles Simonyi's Hungarian notation describes the complete name of a variable. Thus, he wants especially little meaningful variable names as var help: Integer; exclude.

To achieve a better interchangeability of source code, one has (or Simonyi ) on some data types or BaseTypes, agreed. It provides you a slight "C flavor " Determine what concerns the designation (for example, l as long for a 32 -bit integer value ).

Nevertheless, sometimes you need an identifier that is specifically bind the variable to a task. In addition one can attach an arbitrary (of course meaningful ) word. One must note only not to use underscores ( _) and the word in the form " xxxxx " to write down (only the first few letters to write large). There are already some agreed words that have been introduced due to its frequent use for this purpose. Of these, the most refer to an array or a similar structure.

Length ( rgx ); Pascal in the length of the array rgx back. Thus, it is tempting to store the result in a variable culLength. Wrong, this solution is not, as the use of the identifier is not strict. However, it is desirable to use culMax to program standard compliant.

Examples

Prefix and identifier

In addition, prefixes for variable visibility can be defined:

Criticism

Furthermore, a compact set of prefixes facilitates the readability of the code. Particularly in object-oriented code prefixes facilitate the distinction between elementary data elements and (often unprefixed ) objects.

Furthermore, it is sometimes recommended that the Hungarian notation only be used when it is necessary, and then only possible in local variables with valid and visibility so that they are only the programmer a particular function or class visible. For global variables, other programmers would more or less disturbed or even hindered.

403496
de