[AccessD] Naming Conventions

Gustav Brock gustav at cactus.dk
Fri Aug 6 09:17:28 CDT 2004


Hi Brett

> This thread has to end for me.  My paid project work is suffering, so
> here's my last shot at getting my point across.

Oh, please don't deprioritize your job because of this endless (now
Friday) thread.

About the tip on the compiler's catch of those typos:
I didn't know that (thanks for the tip).
But how should I know? I never make a typo!

/gustav

>> I think that Next alone is more safe as it complete eliminates these
> classic typo errors:

>>For I = 1 To 10
>>   For J = 1 To 10
>>   Next I
>>Next I

> In Access 2.0, it gives me a "Next without For" compiler error.
> In Access 2003, VB6 and VB.NET, it me an "Invalid Next control variable
> reference" compiler error.

> I'm reasonably sure that there are no versions of VB or VBA that allow
> this bug to slip past the compiler.  In all cases, the COMPILER
> eliminates the typo error.  Still no chance of introducing runtime
> errors by using my syntax.

> More safe?  From those big, bad compile-time errors?  Gimme a break...
> Next!

>>Would you like:
>>
>>  While N < 50
>>    ' Do stuff
>>  Wend N

> No Sam, I would not like it in a box, with a fox, on a train, or in a
> plane.  You're repeating the same tired argument with different
> keywords.  As I said before (about the If statements and Do loops), this
> loop is controlled by a CONDITION, not a counter variable.  True, the
> condition MAY involve the value of a single variable, but what about:

> ' Wait 1 second
> While GetTickCount() - lngStartCount < 1000
>    DoEvents
> Wend

> So to conclude, I feel that the extra effort of including the For
> counter variable with the Next statement is worth the effort because:

> A) It allows me to tell what block a Next block belongs to, without
> having to scroll up to the For statement.

> B) In cases of nested loops, it helps me to ensure that my code is
> placed within the proper loop.

> C) Using this syntax does not increase the possibility of runtime
> errors, but there is a minor chance that it may reduce them (see B).

> D) Although they are not required by the compiler, I consider them a
> best practice to improve code readability.  As a team developer, I
> accept the fact that the people maintaining my code may not possess
> above average code-deciphering skills like Gustav, and instead tend
> towards average like myself.  _I_ find it easier to read and maintain,
> and obviously there are others who do as well, or else it would have
> been deprecated in the syntax overhaul of VB.NET.  Conversely, I haven't
> heard a reasonable argument why it would make code harder to read or
> maintain.




More information about the AccessD mailing list