OK...let's just cut the name of the thread to 'Best Practices' :)

While there will always be some 'subjectivity' as to 'how' to code, there
certainly are 'better' ways, 'worse' ways, and yes...'best' ways.  It's the
'best' ways that I'm interested in.

Somebody brought up previously that there shouldn't be a central 'best
practices' document, as it may be intimidating to beginners (if i understood
correctly).  I can see that...but I can also see that where a beginner would
learn the 'most simple' or 'most straightforward' way (ie learning <cfif
myVar is ""> before learning <cfif len(trim(myVar))>).

My contention/issue/point is that there are almost always 'better' ways to
code (by better, I'm referring to more efficient).  If I can be a better
coder (which I know I can), I would want to know how.

Yes, one can certainly pick up tidbits of information here and there
(whether it be on the forums, newsgroup, this list, or any of the cf-related
sites out there)...but I'm sure very few of us have the luxury of that kind
of time to look (heck, we wouldn't even know what to look for).

Might be nice to start a "cf coding tips" site...I'd be more than happy to
throw a form online to collect tips from anybody who wants to enter a few
(as well as a page to output them).  Over time it might even become the
basis for a best practices doc (maybe setting up a 'rate this tip' to see if
it really is something that people have found works for them).  I know that
I'd benefit greatly from such a site.  I'd like to think that many others
would as well.

Anybody have any thoughts on that?  Thoughts on hosting?  I can do it, and
would be more than happy to...but perhaps a better known cf-related site
would be a better 'home' for it (i'd still be willing to code it).

Feedback/comments/suggestions appreciated :)

Charlie

----- Original Message -----
From: "Sean A Corfield" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, August 14, 2002 11:28 PM
Subject: Re: Best Practices (was: Re: 33 and 33d the same?


> On Wednesday, August 14, 2002, at 04:22 , Matthew Walker wrote:
> > In this particular case I didn't think the thread had changed. I thought
> > I was talking about whether the concept of using Compare() negated the
> > existence of the issue regarding 33d. I was just woken up and was eating
> > breakfast at the time, so I may have been mistaken, as often I am at
> > that terrible hour.
>
> Ah, the "not enough coffee yet" time... I know it well. Yes, looking back
> at the posts, there were still elements of the original question but I
> think I was frustrated by the 100+ ("lots" anyway) posts with the same
> subject, many of which weren't really dealing with the original issue... I
> just happened to pick your post to reply to because it raised a different
> point that I wanted to address... My bad, too, I suppose.
>
> > While best practices do change from company to company / version to
> > version etc, I think it's reasonable to say there is a more or less
> > established but unwritten set of best practice ideas circulating.
>
> Well, I'm not quite so convinced since there seem to be so many
> disagreements on anything held up as 'best practice'...
>
> > reasoning for that is that I hear the same ideas (e.g. use <cfif x>
> > rather than <cfif x neq 0>) over and over.
>
> And as an example, that's one I would disagree (vehemently) with, unless
> 'x' is a boolean (true/false).
>
> If 'x' is genuinely boolean, then '<cfif x>' is the more intentional way
> to write it (although 'x' is a *terrible* name for a boolean variable! :)
>
> If 'x' is an integer, then the comparison should be against zero - again,
> emphasizing the *intention* behind the code.
>
> With a decent compiler, there should be no speed difference - and even if
> there is, the readability of the code would almost always outweigh any
> marginal performance gain.
>
> When would I sanction using the faster code instead of the more readable
> code? Only when someone had proved to me that in their particular
> application, changing that fragment made a measurable - and significant -
> improvement in execution speed.
>
> I spent years doing code audits and writing coding guidelines around the
> world so I'm fairly passionate about this sort of thing! :)
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
> 
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to