[AccessD] Naming Conventions

DWUTKA at marlow.com DWUTKA at marlow.com
Wed Aug 11 16:15:35 CDT 2004


Funny, I see it the opposite.

It's easy to write, and just as easy to read.  Putting useless prefixes, and
drawn out variable names is hard to write, and in my book, harder to follow.
Odd, a different perspective.....Ack, what to do! LOL

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Jim Lawrence
(AccessD)
Sent: Wednesday, August 11, 2004 12:59 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Naming Conventions


I do agree with you John, completely on this one. I have had my fill
following behind programmers who can and have cranked out code with gay
abandon. A few, I am sure, work under the philosophy that it was hard enough
to write so it should be hard to read.

My two cents worth.
Jim

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of John W. Colby
Sent: Tuesday, August 10, 2004 7:06 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Naming Conventions


>would you really want: Dim lngFieldCollectionCounter As Long

No, I'd want lngFldCnt.

In my world:

lng is an abbreviation for long (everywhere)
Fld is an abbreviation for Field (everywhere)
Cnt is an abbreviation for Count or counter (everywhere)

I DO use EXACTLY that syntax in that situation.  I would NEVER use i in that
situation.  I do NOT switch on and off my use of naming conventions "because
it's just a little piece of code".  A million line program is nothing more
than 100,000 little pieces of code.

I wrote code for a small company out in Carlsbad, CA called Puritan-Bennett.
They make ventilators.  That is life support equipment.  They do things
differently simply because the FDA (or some such government agency) forces
them to.  If your code fails someone could die.

They do code reviews.  Three man teams that look at EVERY line of code.  You
take notes, which are published.  You fix ALL issues found in the code
review.  You do another code review.  You review the code line by line,
looking for issues, but also looking for fixes to the issues found last
time.  You take notes which are published.  You fix every issue found in the
code review.  Repeat until no issues found.

They have written guidelines.  Things like:

No magic numbers (you must use named constants).
ALL case statements have an else that logs an error message if you ever get
there.
Comments!
Naming conventions ALL the time.
Dimming all variables, always, with explicit data types.
Comments!
Using exactly the data type needed.
NO automatic coercion (no depending on the compiler to get it right).  If
you want to coerce a variable you do it explicitly.
Comments!

Etc. and many many more!

You do it that way or you find another job.  The things they do are not bad,
in fact they are very useful.  A little extreme sometimes but very useful.
You learn good programming practices and you use them.  ALWAYS, not just
when you feel like it.  10 (no, closer to 15 years) later I still use many
of them.  I would love to do code reviews but they just aren't possible in
the situations I find myself in nowadays.

By the way, these things mentioned above (and more) are simply known as best
practices and you can find white papers and even books that describe them in
detail.  I did not make them up, nor did Puritan-Bennett.  They exist
because companies found that the costs of best practices are far outweighed
by the costs of fixing the bugs that lack of best practices allow to exist.

You make up some example to justify lazy programming.  There is no
justifying lazy programming, just admit that you don't feel like doing it
(and nobody is forcing you to do it) and get on with life.

John W. Colby
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com
Sent: Tuesday, August 10, 2004 4:58 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Naming Conventions


Okay JC, if I did this:

Dim i as Long
Dim rs As Recordset
Dim strFieldNames as String
....(Opening Recordset)
For i=0 to rs.Fields.Count-1
	strFieldNames=strFieldNames & rs.Fields(i).Name & ", "
Next i
strFieldNames=Left(strFieldNames, Len(strFieldNames)-2)

would you really want

Dim lngFieldCollectionCounter As Long

?????

Give me a break!

Drew


--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list