> Jacob, I was honestly looking for objective views on > the subject. Stop taking everything so personally > and attacking people.
Ahh... Now I understand... the flame war existed before it hit the list. Anybody else here remember a book called the Bitter Butter Battle? > <cfset request.form = structNew()> > <cfset request.form = structCopy(form)> Not really related, but I've taken to using duplicate() in just about all the cases where I would have used structcopy() before. structcopy copies nested structures by reference, which isn't necessarily a bad thing, it's just almost never what I want. It's more efficient than duplicate if you have nested structures and you want to keep only one copy of the data in the nested structures. Though generaly if that's what I want then I don't bother with it either I just use cfset. i.e. Keep a single copy of all values: <cfset structb = structa> Copy a structure: <cfset structb = duplicate(structa)> It's not deprecated or anything... like I say, I just never seem to have a real use for it. > [2] scoping does effect code readability. The example of > code above was taken from real-life, "production" code. > When you reach a form that says value="#firstName#" - you > have 6 pages for the request, plenty of queries (don't get > me started,lol) - Where is the coder to look for the value > of "firstName". Is it a value that was passed from a > previous form submit? Is it a value that was set to a > default? Is it a value passed in the URL? Is it a value > from a query? Why should we suffer another developer to > search for 5-10 minutes to save ourselves from typing > "qMyQuery." in front of that value? This is the larger reason I scope variables... I've seen people tear their hair out over <cfloop query="myquery">#blah#</cfloop> wondering why blah is the same on every iteration of the loop so they know they're not getting the value of blah out of the query and it turns out that blah was defined as a local or url variable. I don't remember the conditions that cause this offhand, but I know it's a fairly common problem with new coders. Somehow I always forget about query issues when talking about scoping -- I guess probably because using the query name is so normal for me now. And even when I see outputs or loops using unscoped column names now I kind of wince/shudder but I usually don't say anything about it. > I think a top priority and quantifiable value to a client > is not only delivering code that squeezes every ounce of > performance, reliability and function our of the serve - > but also to keep one eye on extensibility. Wasting countless > hours on re-coding or searching through spaghetti code is > the most expensive risk that can be assessed because the > ramifications are limitless. That's a whole other conversation. :) And it's the largest reason for FuseDocs and the SPEC xml dialect implemented in the onTap framework. The idea of course being to provide clear, concise, and even reuseable documentation. Synthis corp. produces a product called Adalon ( http://www.synthis.com/products/adalon/editions.jsp ) which is designed to help with the architecting / wireframing and documenting of applications, and they customize versions for various different "communities" of developers. Currently there's a Fusebox edition that writes FuseDocs for you and a Struts edition over and above the CFMX edition. I'd really like to see an onTap edition, though that's going to require community support of the framework, so if you'd like to see it, drop them a line. :) > Always name your variables with meaningful names (username > rather than var038475). Meaningful variable names is one that gets me. I see a lot of new cf developers gratuitously using multi-dimensional arrays for everything... So I'm asked to look over someone's shoping cart code, and I get lines of code in the shoping cart like this: <cfoutput index="i" from="1" to="#arraylen(mycart)#"> #mycart[x][1]# : #mycart[x][5]# : #mycart[x][3]# </cfoutput> And I have to wince... because the variable names here are completely useless to me -- and they're almost never commented... I know all those variables are members of the shopping cart item, but beyond that I have no idea that 1 is necessarily the name of the product or that 5 is the subtotal or 3 is the quantity. 5 could just as easily be the item price or the sku. So I'd much rather see #mycart[x].productname# #mycart[x].itemprice# #mycart[x].quantity#. But somehow a lot of folks just don't ever seem to get the training on structures (even though they use them all the time when they're accessing scopes). I guess to a man with a hammer every problem looks like a nail :) and then to make things worse I've seen people start flame wars over using or not using structures. Blech... s. isaac dealey 972-490-6624 team macromedia volunteer http://www.macromedia.com/go/team chief architect, tapestry cms http://products.turnkey.to onTap is open source http://www.turnkey.to/ontap ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To unsubscribe: Send UNSUBSCRIBE to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org
