Selecting among ColdFusion code reuse methods

The following table lists common reasons to employ code reuse methods and indicates the techniques to consider for each purpose. The letter P indicates that the method is preferred. (There can be more than one preferred method.) The letter A means that the method provides an alternative that is useful in some circumstances.
This table does not include CFX tags. You use CFX tags only when it is best to code your functionality in C++ or Java. For more information about using CFX tags, see Using CFX tags.

Purpose

cfinclude tag

Custom tag

UDF

Component

Provide code, including CFML, HTML, and static text, that must be used in multiple pages.

P

 

 

 

Deploy headers and footers.

P

 

 

 

Include one page in another page.

P

 

 

 

Divide pages into smaller units.

P

 

 

 

Use variables from a calling page.

A

P

P

 

Implement code that uses recursion.

 

P

P

P

Distribute your code to others.

 

P

P

P

Operate on a body of HTML or CFML text.

 

P

 

 

Use subtags.

 

P

 

 

Provide a computation, data manipulation, or other procedure.

 

A

P

 

Provide a single functional element that takes any number of input values and returns a (possibly complex) result.

 

A

P

 

Use variables with names that change from use to use.

 

A

P

P

Provide accessibility from Flash clients.

 

A

A

P

Use built-in user security features.

 

 

A

P

Encapsulate multiple related functions and properties.

 

 

 

P

Create web services.

 

 

 

P

Implement object-oriented coding methodologies.

 

 

 

P

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online