| Defining "Web Applications" |
What makes web application development so different from traditional application development is the Internet itself, and how web clients interact with web servers. Some of the issues that web application developers have to deal with are:
What this all means is that the web has dramatically changed the application development landscape, and therefore traditional application development tools must be replaced with tools designed explicitly to take advantage of the web, while also providing developers with solutions to these and other problems.
| Understanding Cold Fusion |
Cold Fusion functions as a web page preprocessor on the web server, allowing you to embed sophisticated commands into your web page. Cold Fusion pages are plain text files that look much like HTML files. The only real difference between HTML files and Cold Fusion files is the file extension, Cold Fusion files have an extension of CFM. Other than that, whatever you can do it an HTML page, you can do it a CFM page. That, and a whole lot more.
The CFML language is made up of over 50 tags that provide all sorts of functionality, from database integration, to SMTP and POP support, to COM support, and programming constructs like conditional processing and looping. In addition, there are hundreds of third party add-on tags available, and you can write your own custom tags too.
So, how does Cold Fusion work its magic? Well, it goes something like this:
It is important to remember that Cold Fusion only processes its own tags, and leaves any other code intact. Therefore, Cold Fusion supports any and all client technologies, including Java, ActiveX, JavaScript, DHTML, VRML, HDML, and whatever else you'd care to throw at it.
| Database Integration |
Take a look at the code snippet below. The <CFQUERY> tag is the Cold Fusion SQL integration tag. Here it is being used to send a SQL SELECT statement to a database, but it can be used to execute any SQL statement. The DATASOURCE attribute specifies the ODBC datasource to retrieve the data from, and the NAME attribute specifies the name to be used to refer to the query result set.
<CFQUERY DATASOURCE="catalog" NAME="prods">
SELECT product_id, product_description
FROM products
ORDER BY product_description
</CFQUERY>
As soon as Cold Fusion reaches the end of the SQL query (the </CFQUERY> tag) it executes the SQL statement, and stores the results in an array named by whatever is specified in the NAME attribute. This example retrieves two fields from a products table.
To display the retrieved data you'd use the <CFOUTPUT> tag. <CFOUTPUT> lets you mark a block of code to be processed for each row retrieved by the <CFQUERY> tag. The code snippet below creates a standard unordered list (the <UL> tag), but instead of hard coding the list items, a <CFOUTPUT> tag is used to dynamically generate the needed <LI> tags.
<H1>Product List</H1>
<UL>
<CFOUTPUT QUERY= "prods">
<LI>#product_description# (#product_id#)
</CFOUTPUT>
</UL>
Assuming our database table had just three records, this is what the generated HTML would look like:
<H1>Product List</H1>
<UL>
<LI>Gadget (G14)
<LI>Widget (WD10)
<LI>Widget Plus (WP01)
</UL>
And that's all there is to it.
Of course, you could create far more complex and sophisticated SQL statements if so required. Cold Fusion will even let you dynamically construct SQL statements using variables, if statements, loops, and other forms of conditional processing. Cold Fusion fully supports any and all SQL syntax, including joins, unions, sub-queries, aliases, aggregate functions, and stored procedures. And Cold Fusion supports almost every database out there.
| All the Acronyms You'd Want, and Then Some |
| Building Complete Applications |
Scalability - Cold Fusion is highly scalable, as proven by the number of high-visibility commercial Cold Fusion powered web sites, many of which are handling millions of hits a day. Cold Fusion is not a CGI application, it is a multi-threaded web server extension (ISAPI, NSAPI, WSAPI, Apache) and is designed to handle massive loads. And when application load exceeds the capabilities of the hosting server, Cold Fusion applications can be setup to run on multiple hosts seamlessly and transparently.
Security - Cold Fusion is designed to take advantage of any and all existing security systems, including the underlying NOS security scheme, and any web server based security.
Extensibility - Cold Fusion supports all the popular web based technologies and products (for example, HDML, Verity, CyberCash, ICVerify, OpenMarket). You can also extend CFML by writing your own tags in C, C++, CFML, or plug in any COM and DCOM objects as needed. Numerous third party add-on products are now available to further extend Cold Fusion capabilities.
Rapid Development - As seen above, Cold Fusion code is incredibly easy to write. CFML was designed to facilitate rapid prototyping, development, and deployment.
| The Development Environment - Cold Fusion Studio |
However, the best tool for creating Cold Fusion applications is "Cold Fusion Studio", the Cold Fusion IDE. Studio is not an authoring tool, it does not try to write code for you, nor does it hide the underlying code from you. Rather, Studio is a programmers editor, and it is designed to work the way you work. Studio features include:
And that's just the tip of the iceberg. Cold Fusion Studio is without question the ideal editor for both HTML and CFML development.
| Conclusion |
For more information, and to download an evaluation version of Cold Fusion, visit the Allaire web site at http://www.allaire.com. In know time at all, your web site will be powered by Cold Fusion.