(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
- Tag-centric approach can make content integration with HTML designers easier because it's a familiar syntax to them, unlike say a function call (which is also available if desired). For example, you can make custom tags to simplify the life of web designers.
- Fairly good integration with Adobe's rich-client Flash-based and PDF tools
- Parameter statement has a flexible incremental approach to type and requirement validation (see below).
- Flexible, tight associative array syntax (see below).
- Built-in table type for RAM-centric re-querying (although it's somewhat limited on last try, but may have been improved in recent versions.)
- Easy to mix HTML with programming if desired (although many MVC fans claim this practice is "evil", but some argue it depends on the kind of project.)
- The "Administrative Console" offers a quick and standardized way to set configuration info that is often scattered about or inconsistent in other languages/tools, especially with regard to database connections.
- One-based position indexing simplifies the libraries because zero can mean "not found", avoiding the ugly approach taken by PhP.
- Case-insensitive string comparisons, and thus you don't have to litter your code with case converters to avoid case gotcha's.
- Arrays can optionally use a shortcut syntax such as myArray.elementX instead of myArray["elementX"]. It's a lot easier to type and can make code more compact if a lot of array references are used. (The long version is still available for cases where odd characters are in the key.) Partly related: MergingMapsAndObjects.
- OpenSource ports (clones) still are immature, meaning you have to pay for the server versions to get full functionality.
- Support for OOP is round-about (although I hear later versions may have addressed this).
- Not the fastest language in town (but provides built-in caching management to improve perceived performance in some cases).
- Not currently "sexy" or "in".
- One has to be somewhat careful about spaces "leaking" into output and use the HTML echo settings with care. This is the trade-off for the "easy mixing" item above in "Good".
- Using its named-parameter approach in functions is cumbersome. (KeywordParameterPassing). They should have leveraged its XML syntax base to provide strait-forward named parameters.
Could be "good" or "bad" depending on situation or preference:
- Non-"type flag" or "type tag" dynamic typing. May reduce the "hidden flag" confusion that sometimes happens in PHP, leading to a more WYSIWYG typing system. See PageAnchor No-Type-Tags below for an example.
- Integrated with a web-server manager interface. This makes most web-server-related configuration effort and interface consistent across platforms, but may limit special adjustments.
- Use of pound sign as variable insertion marker often conflicts with COLOR attributes, resulting in kludgey work-arounds if working with designers. However, any character choice creates potential conflicts or confusion of one kind or another. Discussion of allegedly better alternatives welcome.
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
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
* contains only calls to classes. A Login Screen might have the structure like so:
<cf_DisplayInterface method="displayHeader" title="System Login">
Note that to UnitTest
this code, you could write tests against the validateLogin method of the LogicInterface?
* 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!!!
* Any non-memory variable manipulation, i.e. File manipulation, database manipulation
* Any recordset returning function, i.e. Queries, File System access, POP3 access, etc.
* 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...
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?
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
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.
MX is now based on a Java engine, and also supports some aspects of OO in the form of ColdFusionComponents
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.
<cfArgument name="xx" type="date" required="true">
Built-in validation includes:
- Type (number, boolean, date, etc.)
- Default value if parameter blank or not given
If you are doing quick-and-dirty scripting, you can just do:
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:
<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 --->
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.
On some projects I use many array references, so it has an impact on coding time and size.
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.
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.
<!-- sample markup to list rows, not CF, but close enough -->
<@tdField name="phone" whenblank="(n/a)"/>
<tr>(sorry, no results found)</tr>
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
like language, in addition to markup. More: http://www.barneyb.com/barneyblog/2010/04/07/coldfusion-vs-cfml/
See Also: FuseBox