12.4. Naming Objects

In the early days of programming, we were limited in the number of characters we could use to name objects and variables. Thus we gave such meaningful names as x, cbw, or A1. Thanks to long filenames in 32-bit Windows, we are now able to identify objects using truly meaningful names, which in Access 2003 means 64 characters—plenty for most purposes. With such flexibility comes a dilemma: how do we name a class?

The name you assign to any database object will have an impact on its perceived purpose, and ultimately, its usability. It doesn't matter much whether it's a form, table, control, or class method; programmers will respond differently to it according to the name you give it. Ultimately it's up to you, but this section seeks to provide a few guidelines to help in the decision-making process.

12.4.1. What Does the Object Do?

I believe the most important aspect of object naming is to describe what it is or what it does. For example, Access has many built-in objects that are, in my opinion, aptly named. These include the Database, TableDef, Collection, Error, and so on. These names unambiguously describe the object to which they refer.

Other names describe the object's purpose, such as the Add, Count, and Remove methods; and let's not forget the OpenRecordset method. Fairly obvious what they do, wouldn't you say?

It is always good practice to keep the names as short as possible. The reason is that long names are really difficult to read and make for annoyingly ...

Get Access 2003 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.