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:

Security Hole - NetCloak Update (1998) Purchased cart being overwritten - still !?? (1997) Ignoring [OrderFile] context (2005) WebCatalog NT beta 18 problem (1997) OT - FCKeditor (2005) Summ=T Problem (1997) I have troubles to send message out (1998) Browser Check for WebDNA compatability (1999) Stripping attachments in shared pop (2005) encrypted query string trouble on OSX (2001) aol (2000) What really killed WebDNA? (2007) WebCat2b15MacPlugin - [protect] (1997) Dismissing dialogs (was 2.1b3 --> way slow) (1997) [WebDNA] Setting up a new server, hierarchy question (2014) Quiestion (1997) MacAuthorize order data fields WAS:How To question... (1997) Problems with [Math] (1998) [WebDNA] Triggers not working (2011) Upload Progress Bar (2003)