G.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 they are combined in the order of prefix(es), tag, BaseName, qualifier, and suffix defined below. Although all parts are not required, nearly every name will contain a tag and a BaseName.

  • 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, by some, considered 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, for example, a table, form, or text box. 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, it isn't always easy to create an intuitive three-letter abbreviation.

  • The BaseName 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 proper 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).

  • A suffix is rarely needed as it's purpose is to differentiate object names that could otherwise be identical. The suffix is written in proper case and should be as short as practical. For example, a series of queries that calculate the average grade for each grade (see the need to make a distinction) could be named qryStudentGradeAvg4, qryStudentGradeAvg5, qryStudentGradeAvg6, indicating the average for the fourth grade, the fifth grade, and the sixth grade class, respectively. And, although we typically avoid using the underscore, some developers like to separate the prefix by using one, as in qryStudentGradeAvg_4.

  • A flag is used to affect where an object appears in lists. You may want to consider flags as a way to put objects at the beginning or the end of a list. Flags and even the object itself may be deleted before deploying the database. Examples of flags and their uses include the following.

    • _ causes the item to be listed before numbers and letters. It is often used for items under development.

    • zh can indicate a system object used for development and maintenance, but it is a hidden object.

    • zs can indicate a system object used for development and maintenance but should not be seen by the end user.

    • zt can indicate a temporary object that is created programmatically, such as a query built by code and not preserved after it has been run.

    • zz can denote an object that you are no longer using and which is waiting to be deleted.

Examples tend to add clarity. So, let's start with a very common and easy to understand example, the name for a table: tblStudent. This example quickly conveys that there are no spaces, that the tag is all lowercase, and that the BaseName is proper case. That is a fairly universally accepted format. Remember, object names should never include special characters or spaces. Other guidelines that you may want to follow are covered later in this appendix, under Rules for Creating Names—Adding the Personal Touch.

NOTE

Remember, object names should never include special characters or spaces.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.53.166