Re: Coding Standards - are there any ?

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 48552
interpreted = N
texte = I actually have VERY strong feelings on this.I've tried to stick to strict naming conventions to avoid confusion in an essentially non-typed language: d_ should precede all database field names m_ for math vars t_ for text vars s_ for skin vars (i.e if I allow for simple dynamic substitution of HTML layout properties) l_ for localized strings ---- I try to put all static strings in a separate include file to make localization simpler. _ precedes all vars submitted through formsWhy is this important?#1 reason: scoping. It is very possible to end up having a form variable, a math/text variable, a database variable, and a tag all have the same name ([date] is a very common example...[cart] could be another...so could [subtotal] or many others....).Not only does this convention thus become self documenting, it also avoids common scoping issues before they even happen.I am a very strong believer in Hungarian notation (or variations of it) and always use it in my non WebDNA coding. After getting bitten a number of times with scoping issues in the past, I now adhere to this convention 100% of the time.Now, there is intrinsically no real reason to differentiate between a math var and a text var since it is possible to use one as the other, I still do for the sake of consistency.I'm very interested in hearing further comments on this..-howardAt 12:21 PM 3/10/2003, John Peacock wrote: >Tom Duke wrote: >> fFIELDNAME >> vVARIABLENAME >> rRECORDID > >That is similar to what is typically referred to as Hungarian notation for >C++: > >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvsgen/html/hunganotat.asp >http://ootips.org/hungarian-notation.html > >Pay close attention to the Ugly section of the second link; don't rely on >the notation to be anything more than a comment when the code was >originally written that the variable had this characteristic. > >John > >-- >John Peacock >Director of Information Research and Technology >Rowman & Littlefield Publishing Group >4501 Forbes Boulevard >Suite H >Lanham, MD 20706 >301-459-3366 x.5010 >fax 301-429-5748 > > >------------------------------------------------------------- >This message is sent to you because you are subscribed to > the mailing list . >To unsubscribe, E-mail to: >To switch to the DIGEST mode, E-mail to > >Web Archive of this list is at: http://webdna.smithmicro.com/Howard Wolosky ------------------------ howard@wolosky.com------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: Coding Standards - are there any ? (Alan White 2003)
  2. Re: Coding Standards - are there any ? (Terry Wilson 2003)
  3. Re: Coding Standards - are there any ? (Tom Duke 2003)
  4. Re: Coding Standards - are there any ? (Charles Kline 2003)
  5. Re: Coding Standards - are there any ? (Howard Wolosky 2003)
  6. Re: Coding Standards - are there any ? (Kimberly D. Walls 2003)
  7. Re: Coding Standards - are there any ? (Dan Strong 2003)
  8. Re: Coding Standards - are there any ? (John Peacock 2003)
  9. Coding Standards - are there any ? (Tom Duke 2003)
I actually have VERY strong feelings on this.I've tried to stick to strict naming conventions to avoid confusion in an essentially non-typed language: d_ should precede all database field names m_ for math vars t_ for text vars s_ for skin vars (i.e if I allow for simple dynamic substitution of HTML layout properties) l_ for localized strings ---- I try to put all static strings in a separate include file to make localization simpler. _ precedes all vars submitted through formsWhy is this important?#1 reason: scoping. It is very possible to end up having a form variable, a math/text variable, a database variable, and a tag all have the same name ([date] is a very common example...[cart] could be another...so could [subtotal] or many others....).Not only does this convention thus become self documenting, it also avoids common scoping issues before they even happen.I am a very strong believer in Hungarian notation (or variations of it) and always use it in my non WebDNA coding. After getting bitten a number of times with scoping issues in the past, I now adhere to this convention 100% of the time.Now, there is intrinsically no real reason to differentiate between a math var and a text var since it is possible to use one as the other, I still do for the sake of consistency.I'm very interested in hearing further comments on this..-howardAt 12:21 PM 3/10/2003, John Peacock wrote: >Tom Duke wrote: >> fFIELDNAME >> vVARIABLENAME >> rRECORDID > >That is similar to what is typically referred to as Hungarian notation for >C++: > >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvsgen/html/hunganotat.asp >http://ootips.org/hungarian-notation.html > >Pay close attention to the Ugly section of the second link; don't rely on >the notation to be anything more than a comment when the code was >originally written that the variable had this characteristic. > >John > >-- >John Peacock >Director of Information Research and Technology >Rowman & Littlefield Publishing Group >4501 Forbes Boulevard >Suite H >Lanham, MD 20706 >301-459-3366 x.5010 >fax 301-429-5748 > > >------------------------------------------------------------- >This message is sent to you because you are subscribed to > the mailing list . >To unsubscribe, E-mail to: >To switch to the DIGEST mode, E-mail to > >Web Archive of this list is at: http://webdna.smithmicro.com/Howard Wolosky ------------------------ howard@wolosky.com------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Howard Wolosky

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

E-Mailer (WebCatb15acgiMac) (1997) show all problem (1997) Strange Search Results (2004) Some basic help (2000) Resume Catalog ? (1997) WebCat2b13 Command Reference Doc error (1997) Error Lob.db records error message not name (1997) PC Auth Hub+Merchant (1998) Weird error/limit - something amiss? (1997) Tax on shipping (1998) Anyone here care to chime in? (2005) Writing to PDF (2003) Document Contains No Data! (1997) Store Builder, technical infos (1998) WebStar Secure on other machine (1997) Emailer prefs in two places ... (1997) summ=T (2003) Date Formats (1997) Getting total number of items ordered (1997) Sorting search by date. (2000)