|
There are many naming conventions to choose from and each
naming convention has what seems like an unlimited number of variants. One such
naming convention is the Hungarian Naming
Convention; named after the nationality of it's creator, Charles
Simonyi. The Hungarian Naming Convention is a robust naming convention that is
easy to implement and has proven its worth over many years.
At a minimum a naming convention should do two things, which
are to describe the data-type of the object or variable you are naming and
describe how it is used within your application. Some examples are:
- tbl for Tables - tblMain, tblLookupPrefix
- qry for queries - qryMonthlyMailing, qryNewMembers
- frm for forms - frmNames, frmAddresses
As with all rules, there are some exceptions. For example,
you almost never see field names in a database table or class modules use more
than a name that describes the object's function within the application.
By using the a Naming Convention you can
avoid problems when working with database objects. For example, if you are
working within Microsoft Access and create a textbox control by dragging the
control onto a form or report from the database field list, Access will give
the textbox control the same name as the field. Normally, this doesn't present
any problems because the properties for the textbox control are different than
the database field but there are a few properties that are the same, which
could cause confusion when adding functions to calculated controls or when
writing code. By appending a prefix such as 'txt' to the beginning of the
textbox control name you will avoid confusion.
You can find more information about the
Hungarian Naming Convention on the Microsoft®
Website.
|