> 3. Queries inside of a cfloop or cfoutput (with the query
> attribute of
> course) and could have easily been avoided with a simple
> join in their
> original query.

> On 5/9/05, Michael Dinowitz <[EMAIL PROTECTED]>
> wrote:
>>
>> How about we look at what makes a programmer look low
>> level and work our
>> way up. Two things that come right to mind are:
>> 1. Improper use of pound signs in evaluation zones
>> 2. Improper usage of IF clauses (not using short
>> circuited Boolean evaluation)

A lot of folks would argue about the pound signs saying that it's just
a matter of preference. I certainly don't care to see pound signs
where they're not needed <cfif #condition#> -- it strikes me as sloppy
and confusing, but I've never made a real issue of it.


by 2. are you referring to people using boolean evaluation without the
"is" or "eq" keywords or people using more conditions than are
necessary for a given if statement? i.e.

<cfif (condition1 and condition2) or (condition2 and condition 3)>

instead of

<cfif condition1 and (condition2 or condition3)>

--

My additions:

1) Improper use of evaluation in general:

good: <cfset myvariable = myothervariable>
bad: <cfset myvariable = "#myothervariable#">

good: <cfset myvariable = mystruct[key]>
bad: <cfset myvariable = evaluate("mystruct.#key#")>

2) Use of arrays where structures are more appropriate

good: mycart[1].productname
good: mycart[1]["productname"]
bad: mycart[1][1]             (not-descriptive)
bad: mycart[1][productname]   (overcomplicated)

(note the lack of quotes in the latter indicating that "productname"
must also be declared as a local variable in this case with a value of
"1").

3) use of snippets or coppy-pasted code -- particularly with MX
(between <cffunction> and CFC's) if you see more than one line of code
repeated just about anywhere, there is almost always a way it could be
encapsulated so that the code wouldn't need to be repeated, thus
creating unnecessary maintenance / development burdens later. This is
more obscure, and ymmv with regard to the amount of code that
constitutes a "snippet". I've been known to agonize over replication
of code that's even one line in length. But then I'm a big fan of Once
And Only Once (OAOO) and Don't Repeat Yourself (DRY).

4) not using cfqueryparam :)



s. isaac dealey   954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:11:2534
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/11
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:11
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.11
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to