Previous Issue Current Issue Main page Next Issue
Fusion Authority Fusion Authority
The House of Fusion Technical Magazine
Issue: 9

February 7, 2000
February 13, 2000
This is an opt-in magazine. To join, leave or change subscription mode, please visit the signup page. All content of this magazine is copyright Fusion Authority, Inc. It may not be reproduced without permission.

Community
Byte Back Bites Back at Under-Employment
Call to CFUGS: Toolset Project will Benefit the Whole Community!
CFUG Changes
 
News
DBPanacea Is Rated Higher than ColdFusion in Benchmark Assessment
Forta Keynote and ColdFusion and Spectra Workshops at WebDesign Conference 2000
 
Tech and Tags
What's New in the Tag Gallery
Versioning in Spectra
Reserved Words in CFQuery
 
Views
Learn or Lose
 
Reviews
E-Commerce Development with ColdFusion:
Conference, February 12-13, 2000
 
Techniques
ColdFusion with Style
 

Community

Byte Back Bites Back at Under-Employment

by S. Malkah Cohen

Fusion Authority recently learned about an interesting new site called ByteBack.org. On the surface, Byte Back is just another computer training company. The inside story is much more interesting, heartwarming, and illustrative of the open hearts of the ColdFusion community.

Byte Back is what my late paternal grandmother would have very approvingly called a "bootstrapper." It is an organization dedicated to helping unemployed and under-employed DC area adults and youth help themselves. By providing computer training, Byte Back enables them to qualify for better jobs, letting them "pull themselves up by their own bootstraps."

In an interview with Janet Lathan, Director of Education and Webmaster for Byte Back, we got a good look at the internal structure of this amazing program. Under the direction of Glenn Stein, ByteBack, a duly vetted 501(c)3 non-profit, has no less than three separate training programs.

The first has the widest reach: Byte Back operates computer training classes for eight different not-for-profits, ranging from homeless shelters to the local Boys & Girls Club's parent outreach initiative. Several more will open this year. Over seventy classes a week (easily 1,000 hours of instruction) are already offered, reaching some 600 students, ranging in age from late teens on up. Classes are small: just 10-12 students, with a Byte Back intern and a volunteer teacher. New sessions open every three months. Classes are, for the most part, free, although some of the participating sites do charge a nominal fee to help cover administrative costs and improve attendance.

Once these courses have been mastered, most students are far more prepared to meet the demands of an increasingly technological work world. Some continue onward to the next phase, with carefully chosen additional candidates, into Byte Back's internship program. Students in this program choose a major as if they were in College, specializing in various aspects of the computer industry, including the Internet and ColdFusion. They also maintain the computer labs and assist the volunteer teachers in the classes given at the various affiliate organization sites.

Ms. Lathan waxes eloquent when discussing the success stories of this part of the program. Of the seven recent graduates, almost half were offered starting salaries of $32,000 or better. Of these three graduates, two had been homeless and another was a graduate of the penal system!

Byte Back's third program is new. A pilot group of 7-19 year olds now meets at Byte Back's headquarters to learn computer skills. The combination of self-esteem-assuring one-to-one attention and the possibility of earning a living (or better) wage upon completion gives these youngster a whole new world of choices and chances.

Michael Smith, noted CF programmer and author, president of TeraTech and organizer of the E-Commerce Conference, held February 12-13 in the DC area, is among the many local area businessmen who are proud to donate their time to Byte Back. "We were so pleased to have students from Byte Back attend our conference, both this year and last," he said. "We hope it helps them take advantage of the many new opportunities available to everyone on the Internet."

[Top]

Call to CFUGS: Toolset Project will Benefit the Whole Community!

A request to all CFUGS came in to beta-test a new toolset. This is the original request, and we'd like all CFUGs to come in and help:

"The Atlanta and Ohio Area CFUGs, in cooperation with ComputerJobs.com are working to develop a custom tag toolset that will enable CF job listings to be extracted from online job databases in a WDDX format. This custom tag set will allow CFUGs to populate their websites with jobs from national, regional, and local job database sites. The tags are set up by default to fetch new job listings at a minimum frequency of once every 24 hours. The tags then cache the job listings to your CFUG server's hard drive as a WDDX packet between fetches.

"The assistance of other CFUGs in the US is requested to help beta test this toolset. Please remember that this toolset is currently in beta, and that either the receiving or sending end of the toolset may change before the final release is made. In other words, please read the release notes before replacing your existing tags with new versions. There may be changes that you need to address.

"Instructions for use are included in the example.cfm file, and you can get he files at the location found below. Bug reports should be sent to dswitzer@pengoworks.com."

(Our thanks to Cameron Childress of ACFUG and the CFUG Manager Newsletter for sending us this information.)

Docs and Example: http://www.oacfug.org/jobs/example.cfm

Toolset: http://www.oacfug.org/jobs/CF_DisplayJobs.zip

[Top]

CFUG Changes

The following CFUGS would like you to know they have new information on the Fusion Authority CFUG page: Atlanta CFUG, Maryland CFUG, Northern Colorado CFUG, and CFUGToronto. Our apologies to anyone we've inadvertantly missed.

[Top]


News

DBPanacea Is Rated Higher than ColdFusion in Benchmark Assessment

SCANDIA, Minn.--(BUSINESS WIRE)--Feb. 11, 2000--Based on a Doculabs benchmarking of DBPanacea against competing products, including ColdFusion, Phoenix Resources Technologies, Inc. announced that it bought 50% of HHPN Development Corporation, the company that developed DBPanacea. The assessment avers that DBPanacea has significant advantages over ColdFusion, especially in the reduction of overall development costs and time-to-production. For more information, visit http://www.businesswire.com/webbox/bw.021100/200420370.htm.

Editorial Rebuttal

I'm always amused to see that ColdFusion is viewed as "the one to beat," and that when anyone does an "independent" evaluation, it always comes up on the losing side. It's also interesting to note that all these "independent" evaluations are done at the request of the "winning product," and in no case is anyone from Allaire or the ColdFusion community consulted on the tests.

A rebuttal from another ColdFusion developer has stated that the testing facility was one of high repute. I personally still don't believe that that says that they know ColdFusion code or know how to write proper code. Bad code can make a product look bad.

[Top]

Forta Keynote and ColdFusion and Spectra Workshops at WebDesign Conference 2000

More ColdFusion in the offing: Ben Forta, ColdFusion Product Evangelist and author of several ColdFusion books, is presenting a keynote speech at the WebDesign Conference held on March 16-18 in Australia. The keynote will be on Web content management, personalization and workflow. Forta will also be doing some ColdFusion and Spectra Workshops, along with Charles Teague, leader of Allaire's WebTeam and Libby Wilson, Allaire Spectra Product Manager.

For more information about the event, or to register, visit http://www.firmware.com.au. (Our thanks to Peter Tilbrook of ACT CFUG for passing along this information.)

[Top]


Tech and Tags

What's New in the Tag Gallery

CF_MailCrutch
This tag is a crutch to the recent CFMAIL problems in the new 4.5 server. Using this tag you can get e-mail messages that couldn't be sent due to unknown cfmail errors, convert them to a cfmail 4.0 format, and send them using a 4.0 server. If you schedule this tag it can provide a quick fix until Allaire relaeases a 4.5.1 update.
Phone Code
Simple tag that takes a string of letters and converts them to numbers for phone dialing. Example: 1 800 New-Home returns 1 800 639-4663.
CFA_DumpQSelect
This tag will take all available datasources on your server and output them into a select box. You can also limit this output to the type of datasource and/or Spectra Datasources.
CF_FindLast
Finds the position of the last instance of a character in a string. It's easy to find the first instance, but no functions currently find the last instance. Takes 3 attributes - the string to search through, the token to search for, and boolean for case sensitivity.
CF_Employee
Online Employee Database. Add, View or remove employees online.Searchable database includes about a dozen details on each employee submitted, as well as an employee photo.
CF_Message_Board
Custom tag allowing simple implementation of a multi-level message board. Includes admin section to delete messages.
PopChart Image Server
PopChart Image Server is a server-side tool written in 100% Java that generates high-quality dynamic charts and graphs and itegrates easily with Allaire ColdFusion or other Web App Servers. PopChart Image Server can generate either GIF, or Flash images from dynamic ColdFusion Queries. Flash Images are smaller, quicker to generate, and allow interaction such as drill-down, roll-over, and popup text.
Window Open Wizard
This custom dialog creates the code to open a second window. Lots of features!
Display Search Results
A custom tag which allows the user to sort, display by alphabet, display by number of records, and jump to a particular page. Version 4.0.0.
OrbForum v1.3
OrbForum 1.3 Latest Standards - Enhancements in this version: Administrator can modify/delete users; Registered users can modify their account information; When viewing a message, the thread that it is contained in will be displayed beneath it allowing users to browse entire threads from one screen; Users can now request to be emailed when there is a response to any particular message; HTML code will now render in the message text instead of being escaped to their literal characters. This application uses the Fusebox 2.0 application development standards, allowing for optimal customization and expansion. Small and fast, and inexpensive, priced at $34.95. Also, when you buy OrbForums, you will receive substantial discounts on future versions.
CF_SafeText
This tag is designed to strip out potential security problems from text that is generated on a web page. Use this tag if you want to take out some HTML tags and javascript handlers, but leave much of the HTML tag set intact. This includes stripping out potentially harmful tags (SCRIPT,OBJECT,APPLET,EMBED,FORM,LAYER,ILAYER,FRAME,IFRAME,FRAMESET,PARAM,META). Also, it strips potentially harmful event handlers (onClick,onDblClick,onKeyDown,onKeyPress,onKeyUp,onMouseDown,onMouseOut,onMouseUp,onMouseOver,onBlur,onChange,onFocus,onSelect,javascript:). It is very easy to change the list of tags and/or event handlers.
CF_ObjectDump v 1.1
CF_ObjectDump is a development tool -- it displays any CF variable. This version is updated to support the binary data type in 4.5 (4.01 version is still included in the zip)
cf_img
Replaces img tag, and will generate rollover code by simply adding src2. Adding an href will generate an image link.
CF_GENERATE_UUID
Simple customer tag to return a SQL UUID.
SiteBuilder v2.0
Browser-based web site creation tool for the non-technical user: unlimited pages, images, custom forms, and links; 99% worldwide browser compliancy. E-commerce and other plug-ins available March 2000.
CS-RCS
GNU RCS compatible, revision control system fully integrated with Windows, HomeSite and ColdFusion. Ideal solution for sites that share common files on UNIX and Windows platforms. (FREE for individuals)

[Top]

Versioning in Spectra

Raymond Camden shows how to add version control to a content object type. Included is how the type is created, what to do differently to prepare for versioning, and how the handlers work with the versioned property.

Versioning in Spectra

[Top]

Reserved Words in CFQuery

ColdFusion reserves certain words and terms for internal use. Using them in a database can cause problems with the CFQUERY properties. For instance, RecordCount, ColumnList and/or CurrentRow cannot be used as column names.

For more information, see Allaire Article 14474

[Top]


Views

Learn or Lose

by Michael Dinowitz

Normally my policy for the magazine is that if an article has nothing to do with ColdFusion, I won't run it or write it. Unfortunately, things have happened that is making me change this policy in a special case: The cyberwars have started.

Let me explain what I mean by this, and I'll tell you that I'm paranoid. Most programmers are; it's part of the programmer personality. We see patterns, we see the forest rather than just individual trees. We see, or at least we believe we see, what's really going on.

What happened last week? Someone or someones, for money or terrorism or just kicks, started orchestrated attacks on large websites. Now let me pull this all together. I'm afraid (I'm paranoid) that this is the beginning of people, countries, companies, whatever, trying to get ahead on their competition by attacking over the web. And why am I bringing this up? Because there are resources out there that you must know about. Because there is information out there that you must see. Because when somebody comes to your site to attack it, you must be ready. You must have defense. You must read.

So listed below are a number of links. Each of these links should be visited, examined, read, and used. Read and implemented. If someone attacks you and breaks into your site and you were informed of the problem beforehand, it's your own fault.

rain.forest.puppy
SecurityFocus
Packet Storm
Allaire: Security Zone
Microsoft TechNet Security Page

[Top]


Reviews

E-Commerce Development with ColdFusion:
Conference, February 12-13, 2000

by Janet Lathan of Byte Back

Have you heard the expression, changing a business from "brick and mortar" to "click and mortar"? Adam Churvis of Productivity Enhancements Inc., speaker at the ColdFusion E-Commerce conference on February 12 and February 13, introduced these terms early in the excellent two-day engagement. The speaker was an apt choice, as his company is the publisher of the Database Blocks ColdFusion development tool. The Conference, sponsored by TeraTech, Inc., CPCUG and MDCFUG user groups, and organized by TeraTech's Michael Smith, was held at the National Institute of Health in Bethesda, Maryland.

On the first day of the conference, Churvis covered E-Commerce with information, code sharing, humor, hints, and occasional personal hobby horses that made the day go quickly and left us all wanting more. He won me over when he asserted that it is more important to have the table designed correctly than to have the query designed correctly, which is an argument I have had several times with my boss. Design was a major theme of the first day; understanding the business, determining the needs of the users, translating this into functional requirements and a development plan-all of these issues were related to the power and promise of ColdFusion.

Churvis's introduction to E-Commerce was provocative and intriguing. According to Churvis, doing business by electronic means will enable communication, increase efficiency, bring down prices through competition, and increase automation. One of the benefits of automation, aside from the usual savings of time and money, is the avoidance of people who don't care and/or are incompetent. Electronic business does, however, carry the added responsibility of having sites with good customer service. Churvis suggests that the site must have "a good people touch."

Throughout the conference, there were invaluable suggestions, evaluations of software and technology, and pithy statements that helped crystallize Churvis's ideas. After an excellent brief discussion on protecting the merchant from fraud, he remarked, "If you can't afford to lose anything, you can't afford to be in business." In the areas where I am the most knowledgeable, I found myself very impressed with his insight and thoroughness-and not merely because he agreed with me! His suggestions on mapping current practices, including the tools to use, the process, and the timing, had the ring of experience hard won.

The second day of the conference was very well-attended, a tribute to the value the participants received on day one. The discussion on scalability, in and of itself, was worth coming for. In this segment of the conference, Churvis offered strategies for making your logic better and your system more efficient. He presented an Architecture Deployment Chart to analyze the logic of a project, which included what programming tools should be used to meet the objectives along a project timeline. This discussion dealt with general methods, rather than specific products or tools. At times during the conference Churvis did recommend and/or demonstrate specific tools--but he did not use conference time to push his company's products. Ideas he discussed include:

Each of these statements was backed up with practical suggestions and examples.

One of the most heartening aspects of the conference was Churvis's offer to share code, help others with code, and welcome us back for subsequent conferences. His patience with questions and obvious satisfaction in helping others are the hallmarks of a mature professional; more than attending a conference, it felt like I was obtaining a mentor.

The conference appealed to both experienced and new users of ColdFusion. Matthew D. Schuster has been the webmaster for the Office of Thrift Supervision for three years. The goal of his site is to provide information to the public and to the industry. Schuster observed that the ideas and tools of E-Commerce as presented in the conference are applicable to his site, even though his business is not an e-commerce venture. He said, "We may not make a profit, but most of the rules still apply. Over 65% of our users are returning to the site, it is important that we please them, and that our information is up to date." The E-Commerce conference is directly applicable, as Matthew is considering adding a shopping cart so that users can choose documents more conveniently. (Schuster also runs a ColdFusion help site, cfanswers.com, where new and experienced ColdFusion users are welcome.)

On Wednesday of this week, just three days before the conference, Kevin Langevin heard about the conference in his new subscription to CF-Talk. He picked up the phone and called Price Line for a ticket from Florida to Maryland, and as of Saturday evening, he was very glad he came. Langevin is coming into Web design from 6 years as a test engineer, and has an emerging career as an entrepreneur. The web designer for his business portal recommended ColdFusion as faster and less expensive than development using ASP. As a conscientious supervisor, Langevin was beginning to investigate ColdFusion and E-Commerce; the conference was the perfect topic at the perfect time. Nor is he disenchanted by the packed content; "It's great; I wish I knew more of the technologies. My next week will be spent on research based on the questions and content of the conference." Especially important to him are the questions that were raised by Churvis regarding security. Langevin won a prize for being the person who traveled the furthest to get to the conference.

There were a few problems, which will probably be worked out as Churvis takes the conference on the road. One was the code itself-although very well commented, it was hard to follow as he scrolled up and down. More printouts or more linear scrolling might have helped. The code will be available to conference attendees.

Also, the conference has too much information to be covered in two days. One solution might be to query the attendees at the beginning of the conference as to their areas of primary interest and adapt the conference accordingly. Another solution would be to have a beginner and an advanced conference, or have a third day aimed at developers for SQL Server, since much of that part of the conference was not as applicable to those of us still working in Access. Although Churvis did an excellent job of presenting material of interest to people with different backgrounds, some of the material could not be covered. One might wonder if he would choose differently if content was decided before the session rather than on the hoof.

Looking at my notes on the conference, I find many substantive topics that I could summarize, but then you might think that I had covered the same material--a poor substitute for the real thing. No matter what your ColdFusion skill level is, if you had attended this conference, you would have left both more knowledgeable and full of questions. A definite "must attend" for anyone interested in helping businesses into the electronic age.

Churvis is already planning further conferences set in other locations. Next up is Birmingham, Alabama on Thursday March 9 through Friday March 10. This one will be free, completely sponsored by InTellitech. Another conference will be held in April, to be announced shortly. CFSeminar.com will be available in the beginning of March, for all registration and management information. For more information, you can contact Adam Churvis at info@commerceblocks.com or call 770-446-8866.

Churvis notes that two days are just not enough. Therefore, his organization plans to extend future conferences to three days. Currently, they are planning to charge a registration fee of $195 for such three-day seminars. Sounds like a lot, but this will include 300-500 pages of supporting materials, including all code AND one website license for ShopBlock, Product Enhancement's new product. Churvis says, "We're not stressing sales, but technology — giving our product away to the registrants so they can get out there and use it!"

Thank you to TeraTech, MDCFUG, CPCUG, and of course to Adam Churvis, for an enjoyable and informative conference!

[Top]


Techniques

ColdFusion with Style

by Michael Dinowitz

"The best laid plans of mice and men often go astray." (John Steinbeck, Of Mice and Men)
No other phrase can fit the reason for this article. I had planned to write a style guide for ColdFusion over time. It would have a number of solid articles covering pieces of ColdFusion such as The Laws of CFSET and how to do fast Text Comparisons in ColdFusion. It would have taken a long time to finish, but would have been solid as a rock. That plan is still in existence, but has changed slightly. The reason has to do with a misunderstanding of terminology.

Methodology - A set of rules that define how an application is to be developed.
Style - A set of suggestions on how to write a template 'correctly.'

Every month or so, someone posts to the CF-Talk list asking about a ColdFusion style guide. Every time it's asked, a discussion starts up, people put in their two cents and there's plans to make an 'official' guide that never gets out of the planning stage. This month it was different. Rather than post ideas and suggestions, most of the people suggested that the poster go and look at the FuseBox methodology. So many people posted the same thing that I just had to respond ahead of schedule. I posted a number of style suggestions I use.

The good thing is that I got some feedback. People had questions and suggestions. The bad thing is that there were very few. A good style guide, even a short one like I posted should elicit controversy. People should be saying that I'm wrong or that they program differently. I must have done something wrong, but I'm going to change that. Below is an extension to the style guide I posted to the CF-Talk list with a few more suggestions and explanations for everything. This time, I expect to hear some feedback.

  1. Pre-Template influences - These are things that you should take into account before the code of a template is even written.
    1. Segment your files - Don't have all of your files in a single directory. Place them in sub-directories that describe what the files are. Images should go in an images sub-directory, files you expect to include should go in an include sub-directory and included queries should go in a queries sub-directory. Additionally, take logical pieces of your application and place them in sub-directories with names that fit the general function. Templates controlling email should go in email and templates that are part of a calendar should go under calendar. This will make it easy to debug sections of code and lead to a cleaner directory structure.
    2. Always use .cfm extensions - ColdFusion uses .cfm files. There is no reason for .inc, .qry or any other 'strange' file extensions. This will only lead to confusion in debugging and problems in editing.
    3. Have meaningful file names - T.cfm just doesn't say anything. Testset.cfm does. Use filenames that have something to do with what the file is actually doing.
    4. Always have an application.cfm and a onrequestend.cfm - ColdFusion assumes that these files exist. It will search for them all the way down to the root on EVERY page request. Even if they're going to be blank, add them to your directory. This saves the server from having to read the drive more than once and prevents a file in an upper directory 'sneaking in' on your templates.
    5. Always save your files as lower case - This is only really important when your dealing with files that will be moved to a Unix system in the future.
  2. Documentation - The programmers bane, until they need to debug or rewrite the code.
    1. Use a standard information header - All ColdFusion templates should have some basic information on the first line. The name of the application the template is part of (or that it's a custom tag), the author and a description of what the template does. This will help you and others in the future when all memory of the application is gone.
    2. Segment your code - A template may do one thing, but that one thing may still have parts. Place double spaces between each of these parts. For example, an importer template would have one segment that uploads a file and saves it. Another segment would read it and loop over the content to place it into a database. A third piece would give you a readout of what happened. These three pieces should be separated if possible (in the same template, not into modules).
    3. Comment each segment - Once you segment your code, have a line of comment to say what the segment does. Any special variables, code or changes should be noted for future reference.
    4. If you comment out code, tell why - Many applications have pieces of code that's commented out because it was wrong, was updated or was just a good idea. If you don't explain why you commented the code out, you WILL forget.
    5. Map your resources - Have a separate document that maps all the resources for an application. Moving an application in a single directory is easy, until you realize you forgot the custom tags. Having a map will tell you all the resources and directories that go into the application.
  3. Code - There are a number of code issues that should be examined. Most of them have to be written up in separate articles due to the depth of information. Until these articles are out, here's the basics.
    1. Every app should have a CFAPPLICATION tag - Even if you're not using state management, you should have a CFAPPLICATION tag going. Most applications have default values and storing them in application variables allows them to be set for the entire app.
    2. Run application defaults ONCE - Most people place CFSETs for application defaults inside their application.cfm files. They expect that the variables will be set once, but in reality they are set on EACH template. A better idea is to use the following code:

      <CFIF NOT IsDefined('Application.DSN')>
      <CFSET Application.DSN = "datasource">
      <CFSET Application.Root = "/htdocs/testbed/">
      </CFIF>

      This will cause the CFSETs to be used ONCE and only ONCE.

    3. Scope your variables - By scoping your variables, you make you applications run faster and easier to understand. If I see Form.UserName, I know that it came from a form.
    4. Never use pounds (#) in an evaluation zone - There are four places in ColdFusion where a variable, function or expression will AUTOMATICALLY be evaluated. These are the CFSET tag, CFIF/CFELSEIF tags, inside ColdFusion functions and inside a CFSCRIPT block. You should never use pounds (#) in these places. Pounds (#) are only needed within a CFOUTPUT block, CFQUERY block or inside any CFTAG (other than CFSET or CFIF/CFELSEIF).
    5. Use functions when doing TEXT comparisons in CFIF - Any time you're doing a comparison between a TEXT value and anything else in a CFIF/CFELSEIF statement, you should use a function. If you're checking to see if a variable is blank (""), then use Not LEN(). If comparing two text strings, use Not CompareNoCase(). If doing a contains, use a FindNoCase(). This was covered in .
    6. Remember Short Circuited Boolean Evaluation - This feature was introduced in ColdFusion 4.01 and was a fantastic addition. It basically says that when a comparison statement (CFIF, CFELSEIF, IIF()) has more than one clause, the result of the first clause can effect if the second is run at all.
      • If the joiner is AND and the first clause is false, the entire statement is false and the second clause will never run.
      • If the joiner is OR and the first clause is true, then the entire statement is true and the second will never run.
      • If the joiner is IMP and the first clause is false, the entire statement is true and the second will never run.
      In all cases, placing your clauses to take advantage of these rules can speed them up.
    7. Never use IIF - If you can help it, don't use the IIF function. It is half as fast as a normal CFIF.
    8. Use CFSWITCH when you can - When you have multiple CFELSEIFs and the variable your comparing is always the same, a CFSWITCH will run much faster and look better.
    9. Use CFSCRIPT - When doing 3 or more CFSETs in a row, placing them within a CFSCRIPT block will speed them up.
    10. Lock network protocols - When working with network tags like CFHTTP and CFFTP, use the CFLOCK tag around them. The network tags are not multi-threaded and if you run them without any locking, you may get PCode errors.
    11. Lock memory-based state management variables - In CF 4.0 and 4.01, you have to lock the setting of memory based state management variables (Server, Application, Session). If you don't, you may find a situation where a value is being written to memory at the same time as it's being read. This will result in a PCode error. This has been slightly fixed in 4.5 (thanks to Seth Petry-Johnson for reminding me).
    12. Restrict your query returns - If you're expecting a single row back from a CFQUERY, set the maxrows attribute to 1. This gives you more information about what you're doing when it comes time to debug or rewrite. Additionally, it may result in a slightly faster query, as you're restricting what you should get back.
    13. Never nest loops deeper than 3 levels - Doing so will result in major slowdowns.
    14. Indent your code - Any code that is inside a 'block tag' (i.e. a tag with an ending tag) should be indented by 1 tab.
    15. Lowercase all paths and files - All file calls and paths should be in lower case. This will save you problems if/when you move an app to Unix.
  4. Modules - ColdFusion Modules are great, but not totally understood.
    1. Use CFMODULE over CF_ - The CFMODULE syntax allows you finer control over the location of your module than the CF_ syntax.
    2. Be careful what you pass - Every call to a ColdFusion module will pass the Url, Form, CGI, Server, Application, Session, Client and Request variables on to the module. This means that there's really no reason to pass these values as attributes for the module.
    3. Use CFINCLUDE over CFMODULE - whenever possible, use CFINCLUDE rather than CFMODULE. Because of the extra information passed to each module, there is more overhead. CFINCLUDEs usually take half as long as CFMODULEs.
    4. Never nest deeper than 3 levels - This is one for both CFMODULEs and CFINCLUDEs. Nesting too deep can slow down your processing and can also lead to problems with debugging.
These suggestions are just the tip of the iceberg. Many more have been written into articles on Fusion Authority and other sites and many more will be written in the future. One important thing you must realize is that the many more to be written must be written by YOU! A style should take into account feedback from the community, practices that are actually being used and ideas of what should be done. It's not for one person, no matter how much they know, to dictate styles. Speak up, make yourself heard.

[Top]


This is an opt-in magazine. To join, leave or change subscription mode, please visit the signup page. All content of this magazine is copyright Fusion Authority, Inc. It may not be reproduced without permission.