L.3. The Fundamentals of the Hungarian Convention

The Hungarian convention has a very straightforward design. It dictates that a name may contain up to five parts, and that the parts are combined in the order of prefix(es), tag, base name, qualifier, and suffix:

  • A prefix precedes a tag to provide clarification. It can describe one or more important properties with one or two lowercase characters.

  • A tag is considered by some to be the critical, non-optional element. A tag should be unique and easily differentiated from similarly named tags. A tag is typically three (occasionally four) lowercase characters that identify what the object is—a table, form, or text box, for example. The tag is usually a mnemonic abbreviation, such as tbl, frm, and txt or the first letter of each word from multiword items. Exceptions are often due to the tag already being assigned for a different purpose, adopting a tag from another program, and, of course, that it isn't always easy to create an intuitive three-letter abbreviation.

  • The base name is a descriptive name that defines the particular object. This could be the layman's term used to concisely identify the subject. Use proper case and be brief but clear.

  • A qualifier is an extension that indicates how the object is being used. Qualifiers should be title case and as short as practical, without sacrificing comprehension. For example, the qualifier Avg may be added to a query name to indicate that the query calculated the qryStudentGradeAvg (or qsumStudentGradeAvg ...

Get Access™ 2007 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.