Gustav Brock
gustav at cactus.dk
Wed Sep 10 03:09:54 CDT 2003
Hi Drew Hmm ... nice talking, but I think you've missed the main points for using naming conventions and prefixes. The idea is to maximize readability of your code and ease maintenance. Thus, the purpose of a prefix is to clarify what a variable could contain and to eliminate code for unnecessary error checking. It is extremely convenient to know that a variable as strStatus is a string as you can pass it without checking for IsNull() to any function expecting a string. Likewise, if you retrieve values from a recordset where fields may be empty (Null) you'll have to use a variant. Again, it is very informative to name such a variable as, say, varSerialNo to indicate that this variable could be Null or may contain a serial number. If you like variables with a content following Drew's brain - which will be a challenge for others to follow (!) - you could simply name that variable Status which would leave no expectations for the reader but raise a flag that caution is needed. You know all this, I'm sure, but a strict naming convention has helped me a lot over the years - and remember: that stranger reading your code might very well be yourself! I think most of our fellow listers have had the experience reading some old code of their own only to wonder what on Earth he/she was thinking when writing that (undocumented) code. I know MS with .net recommends not using prefixes for variables but I just don't understand that ... /gustav > I don't think I have every prefixed a Variant as var, yet. My logic in my > statement is I want a string, so I prefixed it as a string, but it may need > to be a variant, so it's declared as a variant. > Drew > -----Original Message----- > From: Gustav Brock [mailto:gustav at cactus.dk] > Sent: Tuesday, September 09, 2003 3:24 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Days Past Due - Grace Period > Hi Drew >> .. I left the strStatus argument as a variant, in case it is ever >> passed a null > Then you should have renamed it varStatus ... > /gustav