[AccessD] Naming Conventions

Arthur Fuller artful at rogers.com
Wed Aug 11 13:24:10 CDT 2004


Your post reminds me of something I read in "Code Complete", by Steve
McConnell (a book I consider essential reading for any programmer,
irrespective of language(s) used). It was my custom to put all variable
declarations at the top of a given module, but Steve recommends against
that, and suggests instead that declarations ought to go as close as
possible to the portion of the code in which they are used. That struck
me as counter-intuitive but the more I thought about it the more
persuasive I found his argument. Lots of code is produced using
copy/paste. If the declaration is right above the loop or whatever, it's
simple to grab it along with the loop itself, for use elsewhere. And the
compiler sorts it all out anyway, so what you're really talking about is
readability for humans not machines. From that p.o.v., why should you
learn about a variable until immediately before it is used?

Arthur 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte
Foust
Sent: Tuesday, August 10, 2004 11:30 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Naming Conventions


Yep.  I do it, and my boss hates it, although the other developers
appreciate it.  My boss feels that that extra green text makes the code
*hard* to read and is unnecessary is short routines.  My feeling is that
I never know what might get inserted into the middle and it's easier to
keep track if you comment the code when you write it.  I had an
instructor who insisted on this kind of commenting even for declarations
and at the end of a function or sub.

Charlotte Foust





More information about the AccessD mailing list