General Style Guidelines

This section offers some general guidelines for writing clean code. It also shows you how to use Allaire HomeSite or ColdFusion Studio to control your code style:

Set standards for your site

Reuse common code

Indent your code

Set line length and word wrapping

Keep capitalization consistent

In HTML and CFML, it doesn't matter how you capitalize tags, attributes, and values. But it does help to choose one style and be consistent.

In HomeSite or Studio, you can use the Options > Settings dialog box (F8) to control the capitalization and appearance of your code in these ways:

Add comments to your code

If the art of writing is rewriting, the art of maintaining a web site is reusing code wisely. Comments help immensely -- especially if someone other than you will update, inherit, or reuse your code.

Note ColdFusion comments add white space to your pages; in ColdFusion applicati, use the CFSETTING tag to prevent this.

Watch your URLs

Use special characters carefully

The following tables shows a few of the most-commonly used character entities. The Special Characters pane has a more complete selection.

Special Characters HTML Character Entities
Greater-than/angle bracket > >
Less-than/angle bracket < &lt;
Ampersand & &amp;
Quotation mark " &quot;
Non-breaking space &nbsp;
Copyright symbol © &copy;
Trademark symbol TM &trade;
Registration symbol ® &reg;