[AccessD] On Coding Standards

Arthur Fuller artful at rogers.com
Tue Jul 8 11:20:31 CDT 2003


The following excerpt comes from
http://www.vbcity.com/forums/faq.asp?fid=30&cat=General&#TID30570. If the
subject interests you, I suggest you visit there. Here is a preview:

<article>
What are coding standards? 

Coding Standards can relate to all areas of programming. In this FAQ we are
concerned with trying to convey information about an object by using a
naming convention. Naming your objects in a predefined way means you can
tell more about an object purely by the way it is named. 
Lets take a standard Looping variable. If I call my variable 'X' it is not
obvious what it does :- 

Code:For X = 0 to 10 
  ... 
Next X

If we change the name of 'X' it becomes obvious what it is doing :- 

Code:For Index = 0 To 10 
  ... 
End Index

Although 'X' is quicker to type, it is unclear what it is doing. This
becomes more obvious when we have loops in loops:- 

Code:For X=0 to 10 
  For Z=0 to 100 
    ... 
  Next Z 
Next X 

For ParentIndex = 0 To 10 
  For ChildIndex = 0 To 100 
    ... 
  End ChildIndex 
End ParentIndex

The second version is a lot clearer and explains what is happening in the
loops purely by using 'Explanatory Names'. You may be tempted to save typing
by using Letters or short names. Resist this temptation and Cut and Paste
the name while using it. 

</article>

This does not apply to Access, except in narrow areas like creation of types
or classes, but it's an interesting point nonetheless. Like many other
listers, I have habitually created all my variables with type-prefixes.
Given intellisense, this may be obsolete.

What do you think?



More information about the AccessD mailing list