Re: variables... to prefix or not to prefix
Hadn't thought about the reserved words issue. Very good point! On Mon, 13 Dec 2004 12:57:22 -0500, Jerry Barnes <[EMAIL PROTECTED]> wrote: > I prefix my variables. It helps with reading the code and debugging, > especially when someone who didn't write the code is doing the reading > or debugging. I even prefix parameters for custom tags with p_ > (attributes.p_blnDebug for example). Different strokes for different > folks I guess. > > Anyway, here's another reason for prefixes: a coworker used to have > problems naming variables with reserved words. Using prefixes kills > this problem. > > > > J > > -Original Message- > From: Tangorre, Michael [mailto:[EMAIL PROTECTED] > Sent: Monday, December 13, 2004 10:03 AM > To: CF-Talk > Subject: variables... to prefix or not to prefix > > Just out of curiosity, who prefixes their variables with a data type > abbreviation... > > integer - intVariableName > numeric - numVariableName > string - strVariableName > structure - stcVariableName > array - arrVariableName > object - objVariableName > query - qryVariableName > etc... > > We are ever expanding our best practices and guideline documents and > this is an agenda point up for discussion soon... I want to some in with > some pros and cons. > At first glance, the code becomes more descriptive but I do see and have > run into, many problems such as passing around URL params.. do you > really want to give anymore information than necessary into the type of > data within a variable? What about if you encrypt variables?... The > number 1 could be viewed as URL.intSomeId but once encrypted it is no > longer an interger it is a string URL.strSomeId, this only touches the > tip here. > > Anyone have anything to offer on this topic? > > Thanks. > > Mike > > ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187404 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: variables... to prefix or not to prefix
I generally do this when I'm working with arrays of structures and crap, like: arrMonth[31] = structDay; Way back in college, (6 months ago), we used to do it for everything - but it mattered a lot more when we were using very strictly typed languages. ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187410 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: variables... to prefix or not to prefix
I take it a step further and prefix all my internal var variables within a function with $ so there's never a question of where the variable belongs. Its internal only. ($ has been allowed as in variables and as the prefix for variables since MX shipped) I also use single letter prefixes for all my variables in general. i-int b-boolean q-query etc. > I prefix my variables. It helps with reading the code and debugging, > especially when someone who didn't write the code is doing the reading > or debugging. I even prefix parameters for custom tags with p_ > (attributes.p_blnDebug for example). Different strokes for different > folks I guess. > > Anyway, here's another reason for prefixes: a coworker used to have > problems naming variables with reserved words. Using prefixes kills > this problem. > > J > > > Just out of curiosity, who prefixes their variables with a data type > abbreviation... > > integer - intVariableName > numeric - numVariableName > string - strVariableName > structure - stcVariableName > array - arrVariableName > object - objVariableName > query - qryVariableName > etc... > > We are ever expanding our best practices and guideline documents and > this is an agenda point up for discussion soon... I want to some in with > some pros and cons. > At first glance, the code becomes more descriptive but I do see and have > run into, many problems such as passing around URL params.. do you > really want to give anymore information than necessary into the type of > data within a variable? What about if you encrypt variables?... The > number 1 could be viewed as URL.intSomeId but once encrypted it is no > longer an interger it is a string URL.strSomeId, this only touches the > tip here. > > Anyone have anything to offer on this topic? > > Thanks. > > Mike > > ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187406 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: variables... to prefix or not to prefix
I prefix my variables. It helps with reading the code and debugging, especially when someone who didn't write the code is doing the reading or debugging. I even prefix parameters for custom tags with p_ (attributes.p_blnDebug for example). Different strokes for different folks I guess. Anyway, here's another reason for prefixes: a coworker used to have problems naming variables with reserved words. Using prefixes kills this problem. J -Original Message- From: Tangorre, Michael [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 10:03 AM To: CF-Talk Subject: variables... to prefix or not to prefix Just out of curiosity, who prefixes their variables with a data type abbreviation... integer - intVariableName numeric - numVariableName string - strVariableName structure - stcVariableName array - arrVariableName object - objVariableName query - qryVariableName etc... We are ever expanding our best practices and guideline documents and this is an agenda point up for discussion soon... I want to some in with some pros and cons. At first glance, the code becomes more descriptive but I do see and have run into, many problems such as passing around URL params.. do you really want to give anymore information than necessary into the type of data within a variable? What about if you encrypt variables?... The number 1 could be viewed as URL.intSomeId but once encrypted it is no longer an interger it is a string URL.strSomeId, this only touches the tip here. Anyone have anything to offer on this topic? Thanks. Mike ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187402 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: variables... to prefix or not to prefix
We never use prefixes in our codes for simple values since CF is typeless. We usually don't use prefixes for complex values too. Follow the most popular coding guidelines: http://livedocs.macromedia.com/wtg/public/coding_standards/ Murat. > -Original Message- > From: Tangorre, Michael [mailto:[EMAIL PROTECTED] > Sent: 13 December 2004 15:03 > To: CF-Talk > Subject: variables... to prefix or not to prefix > > Just out of curiosity, who prefixes their variables with a data type > abbreviation... > > integer - intVariableName > numeric - numVariableName > string - strVariableName > structure - stcVariableName > array - arrVariableName > object - objVariableName > query - qryVariableName > etc... > > We are ever expanding our best practices and guideline documents and > this is an agenda point up for discussion soon... I want to > some in with > some pros and cons. > At first glance, the code becomes more descriptive but I do > see and have > run into, many problems such as passing around URL params.. do you > really want to give anymore information than necessary into > the type of > data within a variable? What about if you encrypt variables?... The > number 1 could be viewed as URL.intSomeId but once encrypted it is no > longer an interger it is a string URL.strSomeId, this only touches the > tip here. > > Anyone have anything to offer on this topic? > > Thanks. > > Mike > > > > > ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187390 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: variables... to prefix or not to prefix
Mike For CF I've never been much of a fan of prefixes (although I did prefix variables back in my *cough* ASP days) what happens if you change the data-type of the variable... you need to then change the name/prefix of the variable involving a search and replace. Kola -Original Message- From: Tangorre, Michael [mailto:[EMAIL PROTECTED] Sent: 13 December 2004 15:03 To: CF-Talk Subject: variables... to prefix or not to prefix Just out of curiosity, who prefixes their variables with a data type abbreviation... integer - intVariableName numeric - numVariableName string - strVariableName structure - stcVariableName array - arrVariableName object - objVariableName query - qryVariableName etc... We are ever expanding our best practices and guideline documents and this is an agenda point up for discussion soon... I want to some in with some pros and cons. At first glance, the code becomes more descriptive but I do see and have run into, many problems such as passing around URL params.. do you really want to give anymore information than necessary into the type of data within a variable? What about if you encrypt variables?... The number 1 could be viewed as URL.intSomeId but once encrypted it is no longer an interger it is a string URL.strSomeId, this only touches the tip here. Anyone have anything to offer on this topic? Thanks. Mike ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187385 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: variables... to prefix or not to prefix
I tend to prefix only complex types: qQuery sStruct aArray oObjectInstance -joe On Mon, 13 Dec 2004 10:02:39 -0500, Tangorre, Michael <[EMAIL PROTECTED]> wrote: > Just out of curiosity, who prefixes their variables with a data type > abbreviation... > > integer - intVariableName > numeric - numVariableName > string - strVariableName > structure - stcVariableName > array - arrVariableName > object - objVariableName > query - qryVariableName > etc... > > We are ever expanding our best practices and guideline documents and > this is an agenda point up for discussion soon... I want to some in with > some pros and cons. > At first glance, the code becomes more descriptive but I do see and have > run into, many problems such as passing around URL params.. do you > really want to give anymore information than necessary into the type of > data within a variable? What about if you encrypt variables?... The > number 1 could be viewed as URL.intSomeId but once encrypted it is no > longer an interger it is a string URL.strSomeId, this only touches the > tip here. > > Anyone have anything to offer on this topic? > > Thanks. > > Mike > > ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187377 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: variables... to prefix or not to prefix
I don't normally preface the vars...but I do try to be descriptive enough in the var name that it's evident what the var is. For arrays and structs in particular, i'll do something like "empArray" or "empStruct". But as far as explicitly identifying strings, ints, etc...not really. empName is pretty clearly a string. empID is clear enough (IMO) that it's a numeric value. etc. On Mon, 13 Dec 2004 10:02:39 -0500, Tangorre, Michael <[EMAIL PROTECTED]> wrote: > Just out of curiosity, who prefixes their variables with a data type > abbreviation... > > integer - intVariableName > numeric - numVariableName > string - strVariableName > structure - stcVariableName > array - arrVariableName > object - objVariableName > query - qryVariableName > etc... > > We are ever expanding our best practices and guideline documents and > this is an agenda point up for discussion soon... I want to some in with > some pros and cons. > At first glance, the code becomes more descriptive but I do see and have > run into, many problems such as passing around URL params.. do you > really want to give anymore information than necessary into the type of > data within a variable? What about if you encrypt variables?... The > number 1 could be viewed as URL.intSomeId but once encrypted it is no > longer an interger it is a string URL.strSomeId, this only touches the > tip here. > > Anyone have anything to offer on this topic? > > Thanks. > > Mike > > ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187361 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
variables... to prefix or not to prefix
Just out of curiosity, who prefixes their variables with a data type abbreviation... integer - intVariableName numeric - numVariableName string - strVariableName structure - stcVariableName array - arrVariableName object - objVariableName query - qryVariableName etc... We are ever expanding our best practices and guideline documents and this is an agenda point up for discussion soon... I want to some in with some pros and cons. At first glance, the code becomes more descriptive but I do see and have run into, many problems such as passing around URL params.. do you really want to give anymore information than necessary into the type of data within a variable? What about if you encrypt variables?... The number 1 could be viewed as URL.intSomeId but once encrypted it is no longer an interger it is a string URL.strSomeId, this only touches the tip here. Anyone have anything to offer on this topic? Thanks. Mike ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187360 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54