Hi all
can I ask advice about CFMX best practices?
Why? I come from a MS ASP/VB background and there are things that are a real
no-no (see below)
Do any of these apply/are similar to CFMX? any "CF usage" specific best
practices to follow?
thanx
barry.b
(note:
recordset object = query result set
request.form("X") = FORM.X
request.querystring("X") = URL.X
connection object (~ sort-of) <cfquery>
etc)
WHAT NOT TO DO (in classic ASP and ASP.NET)
if you use a recordset value more that once on a page <%= rs("fName") %>
dump it into a local variable first and then use that (prossessing and
memory issues)
same thing for request values: read once into a local variable (same
reasons)
don't store connection or recordset objects (or any objects really) in
session or application scope (memory and threading issues)
fastest/best way to process a recordset: read into a 2D array first (set arr
= rs.getrows()) and then use an inner loop (fields) and outer loop
(records).
don't build results into strings to output (eg in loops). output within the
loop (memmory issues copying the data - except if you use the asp.net
stringBuilder class)
if/then/else (defensive programming) uses less resources (memory,
processing) than Try/Catch
declare the number of array elements up front (have a guess first) instead
of resizing dynamically (memmory issues copying the data).
executing StoredProcs are always faster than executing inline SQL (in the
code) - for the same query
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/