John W. Colby
jwcolby at colbyconsulting.com
Mon Mar 8 14:19:21 CST 2004
Naming conventions is an interesting and useful subject to cover here. I use a convention, loosely based around the LR (Lezinsky-Reddick) convention that even MS promoted before .net came along and they decided that naming conventions were a waste of time. I don't have a copy unfortunately that I can lay my hands on or I would post it on my site. I found this on MS (watch for wrap): http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com: 80/support/kb/articles/Q110/2/64.asp&NoWebContent=1 These elsewhere: http://www.michael-thomas.com/tech/vb/vb_conventions.htm http://www.visibleprogress.com/vb_naming_conventions.htm http://www.developerfusion.com/show/52/3/ Etc. One important thing to note is that there is no "standard". LR was close but for whatever reason the authors decided to stop publishing their standard. I found LR on the inside of the cover of one of the access Bibles, and I loosely adopted it. The accepted wisdom is to find something reasonably common to start with and start using it. Whatever you do, stick to it. You may adapt things as you go and gradually change your convention as you find things that make more sense than what you are using but try your best to stick to what you are using. 1) USE naming conventions, try with all your might to ALWAYS use them (every time you dimension a variable). 2) On that note, set the property of the editor that requires dimensioning variables. In the editor in A2K, Tools / Options / Require variable declaration. This causes the editor to place Option Explicit at the top of every module and FORCES you to dimension a variable before using it. 3) Always dimension variables with the specific type that you need for that variable, avoid Variants like the plague. They have their place - for example passing in data to functions where nulls may cause runtime errors - but should NEVER be used unless you have a damned good reason to do so. I use things like l (lstrLName) for local variables, f (fclsFrm) for form variables declared in form headers, m (mfrm) for module variables declared in module headers. I also try to use c for constants (mclngBlue = 00012345) Others on this list can pipe up with their words of wit/wisdom. John W. Colby www.ColbyConsulting.com