Allaire Cold Fusion

(Now MacromediaColdFusion)

(Now Adobe...)

(10/2011: and rumors Google may buy Adobe)

Cold Fusion is "stack" of tools which includes a commercial Web Application Server (See http://www.macromedia.com for more information) and a tag-based markup language (CFML) which is almost an XmlProgrammingLanguage. Cold Fusion the server is currently written in Java and the CFML pages it runs are converted to servlets and can be compiled, packaged and distributed as a Cold Fusion Application Archive (CAR) file. Sometimes people are referring to the programming language and sometimes to the stack.


Alleged Good and Bad

Good:

Bad:

Could be "good" or "bad" depending on situation or preference:


See FuseBox for one implementation of a quasi ObjectOriented style for coding CFML. It is not unlike the wrapper idea below, but much more formalized. ColdFusion is not an ObjectOriented language. FuseBox is not the same as ExtremeProgramming.

These are not bad things. I have been using AllaireColdFusion for a few years now, and it is great. It does what it does very well! (and v.5 adds some great new functionality, as well)


These are some notes not only on how to best use ExtremeProgramming with Cold Fusion, but how best to use ObjectOrientedMethodologies? in writing your ColdFusion applications. Cold Fusion, however, is NOT Object Oriented, and this is AS FAR as I would go with trying to use OO techniques in CFML coding.

        * Wrapper files contain only calls to custom tags (essentially classes). 
        * Custom Tag files, or Classes, contain methods 
        * methods are instantiated by passing the METHOD parameter in the Custom Tag call 

Wrappers
        * contains only calls to classes. A Login Screen might have the structure like so: 

<cf_DisplayInterface method="displayHeader" title="System Login"> <cfif isDefined("form.username")> <cf_LogicInterface method="validateLogin"> <cf_DataInterface method="authenticateUser"> <cf_DisplayInterface method="displayMainMenu"> <cfelse> <cf_DisplayInterface method="loginForm"> </cfif> <cf_DisplayInterface method="displayFooter">

Note that to UnitTest this code, you could write tests against the validateLogin method of the LogicInterface? class.

Classes

        * Logic 
                * functions... sort of, ColdFusion (4.x) doesn't allow for creation of functions so we'll call them pseudo-functions (v.5.x now supports UserDefinedFunctions? ) 
                * variable manipulation 
                * structure, array and/or other memory variable manipulation 
                * you can create and run UnitTest s against these. I finally figured out a way to UnitTest ColdFusion applications!!! 
        * Data 
                * Any non-memory variable manipulation, i.e. File manipulation, database manipulation 
                * Any recordset returning function, i.e. Queries, File System access, POP3 access, etc. 
        * GUI 
                * HTML is contained within this class 
                * CFML can be mixed in, but no business logic, just simple display logic, such as taking the title variable and displaying it. 

more to come...

- TadMurphy

Oh my! I am hoping I can be of some service. I have strong, well-informed convictions that AllaireColdFusion is a very poorly designed language (in comparison with similar alternatives) and an equally poorly service implementation. I would hate to think that my comments would not be useful, however, so I won't start now. The reason why I would like to contribute on this topic is that I have experience using AllaireColdFusion and hope to use this to discourage anyone from using it for nontrivial work. Would information to this effect be considered useful and relevant?

- ChrisMountford?

Chris, I would suggest you take a look at ColdFusionMX. Having started in CF5 here and moved to MX last year, we've been able to dramatically improve our coding practices. It's not the best designed language, but I've never been able to develop so rapidly. -- LaraKramer

Chris, I am surprised to here you say that AllaireColdFusion is a poorly designed language. I have found just the opposite. It fits in very well with the XML languages it supports. Also, the tag like structure makes it less intimidating for Web designers to use. The ability to hook into other languages such as CeeLanguage, CeePlusPlus and JavaLanguage means that I can write my code in the appropriate language and hide the details from non-programmers, they only have to add a new "tag" into their XML/HTML files. -- JohnGriffin?

It is definitely a "teamwork language" in that it is designed to allow multiple disciplines to work on a given project. Thus, developers may not like some of the programming concepts it uses, but bringing together graphic designers, content managers/editors, query writers, and developers is something corporations like about it. Developers can create custom HTML-like tags for graphics designers and content authors to use so that they don't have to know C-like syntax to insert pre-defined function-like actions, templates, or widgets into their HTML.


My biggest complaint about CF is that it is hard to make "real" subroutines. There are some commands that don't work inside subroutines, or the weird scoping rules get in the way, making generic routines tougher to build.

MX has full routines now. "CFfunction".

However, I will agree that it makes it easier for a web designer (HTML, graphics, webmaster, etc.) to get up to speed. "Hard-core" programmers probably will not like it, but newbies to programming will probably catch on to CF much quicker than they would to say Perl or Java.

ColdFusion MX is now based on a Java engine, and also supports some aspects of OO in the form of ColdFusionComponents (CFCs), which are very much like JavaScript Objects (ie Prototype-based Inheritance)


It is extremly simple to creat quite powerful applications with CF and the learning curve really impresses me. PHP does give the developer greater flexibility, but at the cost of being byzantine and many functions being somewhat redundant. CF code is highly readable and for developing simple web applications it's a great product in my opinion. -CP


To echo what others have said, CF MX really expands what you can do and adds a lot of the functionality people have been wanting to do "real programming", like objects (sort of) and user-defined functions that are first class. CFCs can do some pretty cool auto-magical things, like exposing themselves as web services.

What is a good example of needing objects? I don't find very many.


Advanced Parameter Checking

One nice feature of CF is in how function parameters ("arguments") are defined. You can optionally add type-checking and existence-checking.

 <cfFunction name="foo">
    <cfArgument name="xx" type="date" required="true">
    ....
 </cfFunction>

Built-in validation includes: If you are doing quick-and-dirty scripting, you can just do:

 <cfFunction name="foo">
    <cfArgument name="xx">
    ....
 </cfFunction>

It's a nice option to be able to incrementally shift from super-scripty to a type-centric semi-BondageAndDisciplineLanguage.

And this provides room for a comment on each parameter:

 <cfFunction name="foo">
    <cfArgument name="xx" type="date">     <!--- Date of last change --->
    <cfArgument name="yy" type="boolean">  <!--- True if page is all green --->
    <cfArgument name="zz" type="number">   <!--- IQ of user --->
    ....
 </cfFunction>

C-style languages cannot compete on this, at least not without ugly, hard-to-read syntax.

Note that 3-dash comments ("<!---...--->") are "hidden" comments that don't show up in HMTL, unlike 2 dashes.

Two drawbacks or areas for improvement include being able to use the same mechanism for named parameters (similar to VB.net), and the inability to add custom validation to the cfArgument tag, such as a condition statement (not unlike CFloop's WHILE equivalent).


It has a nice associative array syntax in which you can use a dot instead of quotes and square brackets if the key doesn't contain any "funny" characters. You can still use the "traditional" square bracket approach when desired or if the index name has problematic characters.

 myArray.elementX
Versus

 myArray['elementX']

On some projects I use many array references, so it has an impact on coding time and size.


GraphAlgorithmsWithTables contains an example.


I was looking a way to build a flexible "templating" system for web designers / graphic artists. They want to control the formatting and HTML without too much programmer intervention other than some basic reference examples, but use a content database to populate most of the repetitious items (programmer builds the CRUD screens/listings). The best draft solution I came up with more or less re-invents ColdFusion (CF). It's hard to improve on the product for something that straddles both the programming and the designing world. Perhaps I'm influenced by my prior exposure to CF? If you can suggest a better approach, I'd be glad to take a look.

PHP.Gt. It was invented by one of my students, and although the Web site (phpgt.com) is still in its infancy, what I've seen demoed looks very promising. It's an "un-framework", the bare minimum of glue necessary to effectively bind PHP/Javascript/SQL written by programmers to vanilla HTML/CSS written by designer/artists. Instead of creating a separate language (a la ColdFusion) or embedding HTML in PHP or PHP in HTML, or using some awkward template system, or relying on a complex framework, it relies mainly on a handful of trivial policies to ensure that the PHP/Javascript code will recognise relevant HTML/CSS definitions. Its main claim is to "respecting Web technologies", i.e., that you can write good PHP/Javascript, or sound HTML/CSS, or good SQL, without having to blend them or blur the boundaries between them. PHP.Gt takes care of the integration.

It's not the programming side that I'm looking to juice up. It's mostly the designer's side that needs the most help.

I think PHP.Gt might help, particularly as it does not require the designers to learn any new technology. They can use HTML/CSS just as they would for static pages.

Perhaps, but to tune it so it works best for them: markup tags, will end up looking a lot like CF anyhow.

They don't need new markup tags. They use plain HTML/CSS.

Example:

  <!-- sample markup to list rows, not CF, but close enough  -->
  <table class="foo">
    <@queryLoop queryname="contact">
      <tr class="niff">
        <@tdField name="firstname"/>
        <@tdField name="lastname"/>
        <@tdField name="phone" whenblank="(n/a)"/>
      </tr>
      <@norows>
        <tr>(sorry, no results found)</tr>
      </@norows>
    </@queryLoop>
  </table>
Yes, that's the kind of stuff they wouldn't have to learn. Standard HTML table definitions are sufficient.

Huh? Somebody somewhere has to specify such information to something using some kind of interface (markup, CRUD screen, api calls, punched cards, etc.). You seem to be making an unstated assumption. Walk us through a typical designer activity scenario to set up something like the example. Assume for now that the programmer has already written the query (called "contact" here).

Ok. Rather than wave my arms, I've asked the developer to provide an example -- with source -- of a database-driven app with at least one form. I'll link to it here when it's available.

[...a few days pass...]

He's created an example. See PhpGt.


Popularity Measurement Complaints

There have been complaints by Adobe and CF fans that it's excluded from the TiobeIndex because it's apparently counted as a "platform" and not as a language, per se. Most of the time it's referenced as "ColdFusion" and not CFML on web pages, in part because the platform includes a JavaScript like language, in addition to markup. More: http://www.barneyb.com/barneyblog/2010/04/07/coldfusion-vs-cfml/


See Also: FuseBox, ColdFusionLanguageTypeSystem, BradyBunchGridDiscussion (scattered mention)


EditText of this page (last edited October 17, 2014) or FindPage with title or text search