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:

test don't read (1998) Searching an Email database (1997) Putting [cart] into a database (2003) form data submission gets truncated (1997) Bug? (1997) WC 2.0 frames feature (1997) international time (1997) Database Options (1997) Serving images from databases (1998) getting images' width/height (1998) PSC recommends what date format yr 2000??? (1997) The Guru Speaks-very long reply (1998) os 8.5 (1999) WCS Newbie question (1997) More help for discount pricing (1998) Frames and WebCat (1997) WebMerchant when CC network is down (1998) WebCat2b15MacPlugin - showing [math] (1997) Re:no [search] with NT (1997) ErrorMessages.db (1998)