NAMING CONVENTIONS: A PRIMER

Naming conventions are one of the foundation elements of your overall development style. We developed our naming conventions primarily to achieve the following four objectives:

  • To be able to quickly understand an application's structure and code by making object names more informative

  • To simplify team development of applications by creating a standardized vocabulary for all team members

  • To improve our ability to work with Access objects, including enforcing object name sort orders, creating self-documenting program code, and enhancing find-and-replace capabilities

  • To increase our ability to create tools for our Access development work, and to create code libraries across various VBA platforms

To meet these objectives, we created and applied consistent naming conventions to the following Access application objects:

Tables (Jet/SQL Server) Macros
Table fields Modules
Queries Procedures
Forms Variables
Form and Web page controls Constants
Reports User-defined types
Report controls Data Access Pages

Because object names are the foundation on which your entire application is built, they're almost impossible to change after development begins in earnest. Therefore, you probably won't find it cost- or time-efficient to retrofit these conventions into your existing applications. For new applications, however, you should apply these naming conventions consistently from the moment you create your first object in a new Access database file.

Our naming conventions rely primarily on leading tags—several characters placed before an object's name (for example, qryOrderByMonth). This approach is sometimes referred to as Hungarian notation. Leading tags provide several benefits:

  • The first thing you see about an object when you see its name is the leading type tag, which is often more important than the name itself.

  • Leading tags drive the ordering of object names in Access and VBA object lists, sorting by type and then by base name.

  • Leading tags are consistently located in the same place in an object's name, making them easier to find by parsers and other tools.

If you're averse to Hungarian notation for some reason and prefer trailing tags, LNC will still work for you. However, LNC prescribes no standard for locating and punctuating trailing tags. You'll have to decide whether they're offset with an underscore (OrderByMonth_qry), by capitalization (OrderByMonthQry), or by some other technique. Remember also that you should be consistent throughout your style, so if you use trailing tags for objects, you'll need to use them when writing VBA code as well.

Because some developers—especially newer ones—prefer to minimize the complexity of a naming convention, LNC provides the following two levels for Access users:

  • Level One has the minimum realistic subset of tags, but consequently provides lesser detail about the application. It's intended for users whose work centers around the Database window and who don't develop applications, only database objects.

  • Level Two provides greater detail and the flexibility to create your own extensions. It's intended for application developers.

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

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