ColdFusion
|
- This article is about the computer programming language. For the nuclear reaction, see Cold fusion.
In computing, ColdFusion is a tag-based, middleware programming language used chiefly for writing web-based applications. The language was created by JJ Allaire and his brother Jeremy Allaire, but the product is currently owned by Macromedia (to be acquired by Adobe).
Cold Fusion 1.0 was officially released on July 10th of 1995 by Allaire. The tag-based programming language used was called DBML (DataBase Markup Language) and was later renamed to CFML (ColdFusion Markup Language). Beginning with version 1.5, ColdFusion contained compatibility with C++, allowing users to develop extensions to the language. Years later, this would be the basis for ColdFusion Extension (CFX) Tags, a method of extending the ColdFusion language. Later versions of the language allowed extending the language by writing custom tags in Java and CFML itself. The product was also renamed ColdFusion (one word) - most likely to make it trademarkable - about this time. Starting in version 5.0, users could also define functions to extend the language (UDF = User Defined Function).
Meanwhile, Allaire began work on rewriting the basis of ColdFusion with Java (codenamed "Neo"), which would allow for greater portability among different platforms.
On January 16, 2001, Allaire announced that it would be merging with Macromedia. Shortly after the merger, Macromedia continued with the incremental release of ColdFusion 5.0 and in June 2002, Macromedia released Macromedia ColdFusion MX, extending the naming convention of Macromedia's line of products. However, with the release of ColdFusion 7.0, this convention was amended, rendering the product name "Macromedia Coldfusion MX 7". ColdFusion MX was completely rebuilt from the ground up and was based on the Java 2 Enterprise Edition (J2EE) platform. ColdFusion MX was also designed to integrate well with Macromedia Flash using Macromedia Flash Remoting MX.
ColdFusion has been used to write millions of webpages and is generally recognized to be the easiest rapid development language for people coming from straight HTML to learn. This is partly because it is tag based like HTML, and also because of the strong user community around ColdFusion. This includes user groups, listservs, conferences and the Fusebox and Mach-II methodologies for organizing ColdFusion code.
Besides being easy to learn, ColdFusion like JSP and ASP.NET is compiled to an intermediate format (bytecode), making it typically execute faster on the web than interpreted languages like PHP or ASP.
With the release of ColdFusion MX, the CFML language was extended to support basic OOP. Apart from the tag-based CFML syntax, ColdFusion also supports embedded scripts that can be written in a JavaScript-like language.
ColdFusion unlike competing technologies, e.g.PHP, is a commercial product but is available as a free feature-complete "developer version" from the Macromedia.com website. This allows developers to run a local copy of the complete enterprise system for local testing. In addition to ColdFusion, BlueDragon also offers a free "developers version" that has certain limitations.
More recently there have been several new companies offering CFML language engines including a freeware implementation by New Atlanta and IgniteFusion.
The ColdFusion application server can be used alongside an existing HTTP server application such as Apache or IIS, or it can serve as its own limited HTTP server for development purposes.
Contents |
Potentially Competing Products
ColdFusion is a proprietary technology based on Web technology industry standards, however, it is becoming a less closed technology through the availability of a potentially competing product. The company New Atlanta has released their Blue Dragon product which provides a ColdFusion MX 6.x-compatible platform to run some CFML-based applications. With the release of ColdFusion MX 7, offering many new ground-breaking features not available in Blue Dragon, Macromedia ColdFusion MX 7 now has U.S. patents pending.
Blue Dragon is mostly compatible with the Macromedia ColdFusion MX 6.x, especially in its Blue Dragon 6.2 version launched in early 2005. Available in four editions: Blue Dragon Server, Blue Dragon Server JX (similar to ColdFusion Standard), Blue Dragon Server for J2EE Application Servers and Blue Dragon Server for .NET.
There are two striking differences between Blue Dragon and ColdFusion, the first being that Blue Dragon is available in a completely free edition for commercial purposes. This free edition is generally compatible with ColdFusion MX 6.1 providing almost the same functionality as their commercial editions, and will allow it to gain favor with people looking for a free application platform. Macromedia also provides a free edition of ColdFusion MX, however that free edition is not intended for commercial purposes. There are several main limitations with this Blue Dragon release, however, including that it does not support database-specific JDBC drivers, it does not work with secured (SSL) connections, and it is not legal to use it in a commercial web hosting facility, for that you must obtain the commercial editions. Further, CFML tags and functions are implemented differently between Macromedia ColdFusion MX and Blue Dragon, which may result in a wide variety of subtle runtime compatibility differences, so caution is warranted. New Atlanta maintains a complete list of incompatibilities with Macromedia ColdFusion MX in the documentation.
The second major difference with Blue Dragon is that it is available in an edition designed to run on Microsoft's .NET platform, opening companies to the possibility of an easy to use application development platform without the need for any additional middleware. This major enhancement has allowed New Atlanta to improve marketshare, especially within companies that focus on Microsoft technologies.
In addition to Blue Dragon, other ColdFusion runtime engines include IgniteFusion and Coral Web Builder.
Acronym
The acronym for the ColdFusion Markup Language is CFML. When ColdFusion templates are saved to disk, they are traditionally given the extension .cfm or .cfc for ColdFusion Components. The original extension was DBM or DBML, which stood for Database Markup Language. When talking about ColdFusion, most users use the Acronym CF and this is used for numerous ColdFusion resources such as user groups (CFUGs) and sites (CFTips.com).
CFMX is the common abbreviation for ColdFusion versions 6 and 7 (aka ColdFusion MX).
Code example
Query your database:
<cfquery name="nameofquery" datasource="odbc_connection" username="simple" password="enough"> SELECT * FROM table WHERE field = 'whateveryouaresearchingfor' </cfquery>
Loop through your records:
<cfoutput query="nameofquery"> #nameofquery.field_from_query# <!---Above is called a variable, this text here is just comments ---> </cfoutput>
Set and display a variable:
<cfset sMyVar = "A Variable defined in CFML"> Here is the contents of the variable: <cfoutput>#sMyVar#</cfoutput>
Define and use a function:
<cffunction name="AddTwoNumbers" returntype="numeric" output="false" hint="I add two numbers."> <cfargument name="NumberOne" type="Numeric" required="true" hint="I am the first number."> <cfargument name="NumberTwo" type="Numeric" required="true" hint="I am the second number."> <cfreturn NumberOne + NumberTwo> </cffunction> <cfoutput>#AddTwoNumbers(2, 2)#</cfoutput>
Define a class / component:
<cfcomponent> <cfset variables.someproperty = ""> <cffunction name="getSomeProperty"> <cfreturn variables.someproperty> </cffunction> <cffunction name="setSomeProperty"> <cfargument name="value" required="true"> <cfset variables.property = arguments.property> </cffunction> </cfcomponent>
Syntax
CFML provides two different syntax formats for you to use, each with their own pro's and con's.
Tag-based Syntax
CFML follows an XML/HTML-alike syntax in that all commands are written in the format:
<cfcommand argument="something">Some text</cfcommand> <cfset variable="some data">
CFSCRIPT Syntax
An additional syntax format is available that is similar to Javascript:
<cfscript> command('argument 1', 'argument 2'); </cfscript>
This second format provides a cleaner migration path for people with experience in C-style languages: C, C++, Java, Javascript, etc. One thing to remember is that to use this syntax you must include the cfscript command around the code block-- you can't just launch into cfscript.
Development Aides
To aid in developing applications using ColdFusion there are a number of tools and frameworks which can take some of the pain and learning curve away.
Development Tools / Environments
- Macromedia Homesite, an editor designed for hand coding.
- Macromedia Dreamweaver, the multi-faceted WYSIWYG & code editor.
- cfeclipse, a powerful plugin for the Eclipse.
- Plum.
Code Frameworks
- Fusebox, through Fusebox 4.1.
- Mach-II, a purely OOP framework.
- Model-Glue, an OO framework based on the MVC pattern
- onTap Framework.
- Plum provides its own framework.
External links
- Macromedia's ColdFusion site (http://www.macromedia.com/software/coldfusion/)
- CFFaq (http://www.cffaq.com/)
- A brief history of ColdFusion (http://www.tophosts.com/articles/?3016.html)
- ColdFusion conference listings (http://www.cfconf.org/)
- ColdFusion bug lists (http://www.cfbughunt.org/)
- ColdFusion User Groups (http://www.macromedia.com/cfusion/usergroups/)
- Free ColdFusion Hosting at CFMXDeveloper (http://www.cfmxdeveloper.co.uk)
- ColdFusion Mailing Lists (http://www.houseoffusion.com/cf_lists/)
- ColdFusion Magazine (http://www.Fusionauthority.com/)
- CFGIGOLO weblog (in Portuguese) (http://www.cfgigolo.com/)
- Common Function Library Project (http://www.cflib.org/)
- Pete Freitag's Blog (http://www.petefreitag.com/)
- Full As a Goog Blog Aggreagator (http://www.fullasagoog.com/)
- onTap Framework (http://www.fusiontap.com/)
- Plum IDE (http://www.productivityenhancement.com/)
- Tarantor's ColdFusion Blog in Turkish (http://www.demirkapi.net/blogcfc/)
- IgniteFusion a freeware CFML engine (http://www.ignitefusion.com/)cs:ColdFusion
de:ColdFusion nl:ColdFusion pt:ColdFusion ru:ColdFusion tr:ColdFusion zh:ColdFusion