What usually happens if code is bigger than 200 lines (or some arbitrarty
small size) is that you cannot look at the code and determine what it is
doing easily.

As an example, the following template (act_create_section.cfm) is used to
create a section for a site:
<!---
|| BEGIN FUSEDOC ||
|| RESPONSIBILITIES ||
Create a new section id, insert the details, then call the edit form.
|| HISTORY ||
Author: [EMAIL PROTECTED]
|| ATTRIBUTES ||
RFA.submit : The submit action for the property form.
+++ ../act_getNextid.cfm
+++ dsp_section_properties_form.cfm
|| END FUSEDOC ||
--->
<cfinclude template="../act_get_nextid.cfm">
<CFQUERY name="insert_section" datasource="#request.site.mainDSN#"
dbtype="#request.site.mainDSNtype#">    
        INSERT INTO Sections (section) VALUES ('#act_get_nextid.newid#')
</CFQUERY>
<cfset attributes.section = act_get_nextid.newid>
<cfinclude template="act_install_document_directory.cfm">
<cfinclude template="dsp_section_properties_form.cfm">

The steps are:
Get a new id
Insert the new section
Install the section document directory
Then display the form where they can edit the properties of the new
section.

I don't need to know how things work, just the input parameters for each
template that are required to get it to do what it says it will do. 

Also because I have created a number of small steps to do a specific task
I can re-use steps as and when I deem them necessary. It also means that
should I change the way I do a step (i.e. getting a next id) then as long
as the step returns the same set of output data in the sameway before the
change, ALL code that invoked that step will also continue working.

Have a look at fusebox.org . Although you may not want to use the
methodology, the best thing about the methodology is that it encourages
you to develop using very small steps. Which means maintenance is a lot
easier...

Adam



-----Original Message-----
From:   [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent:   22 February 2001 12:18
To:     CF-Community
Subject:        Re: CF-Community-List V1 #120

In a message dated 02/21/2001 11:31:04 PM Eastern Standard Time, 
[EMAIL PROTECTED] writes:

> Isn't that a tad on the big side? Not that I've seen your code or
anything
>  but large files in excess of 200 lines usually can be broken down into
>  smaller steps using cfinclude. Where the cfincludes do one action for
the
>  page (ie like a query).
Adam,
Why should you make the page less than 200 lines of code?

Jo-Anne Head
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-community@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to