Have you ever stopped to think about just how much functionality is baked into ColdFusion? We use <CFQUERY> to work with databases, allowing for highly flexible and dynamic SQL as well as query caching and more, and this is powered by a sophisticated internal engine. We use tags like <CFCHART> and expect charts to be generated and displayed, without every really paying attention to the fact that an entire Java based charting engine is built in and actually doing the heavy lifting. The same is true for <CFPDF>, <CFIMAGE>, <CFSEARCH>, support for SOAP and Web Services, XMPP and JMS integration, and so much more. While most of us focus on CFML the language, the truth is that the bulk of ColdFusion, the majority of what gets installed, is not the language but the extensive array of integrated services, services that are exposed to ColdFusion via CFML tags and functions.
But what if these services could be accessed outside of ColdFusion? If a PHP developer in the next cube over needed to merge PDF files, why couldn't he invoke ColdFusion's PDF manipulation services? If a .NET developer needed to access Microsoft Exchange, why couldn't she use ColdFusion's brilliant Exchange tags (rather than having to write lots and lots of .NET code, and I do mean lots and lots)? What about the Java developer who needs to easily manipulate spreadsheet files without tinkering with low level libraries?
And while we're at it, what about the Flex developer who needs to generate an e-mail message? Flex (well, Flash) has no built in SMTP libraries, and so Flex developers who need to programmatically generate e-mail messages do so by writing code on the server. For ColdFusion developers this means creating a ColdFusion Component which accepts data from a Flex application (likely via an AMF call) and then passes that same data to a <CFMAIL> tag. In other words, code is being written on the server just to be able to pass data from Flex on the client to the <CFMAIL> tag. So why couldn't a Flex developer just invoke <CFMAIL> directly, passing it name=value pairs so it can generate an e-mail?
Well, with the upcoming ColdFusion Centaur, the answer to all of these questions is yes, these are all doable! In ColdFusion Centaur we're exposing lots of those integrated ColdFusion services via AMF (Flash Remoting) and SOAP (Web Services). The PHP, .NET, and Java developers can invoke ColdFusion built-in Web Services, pass in data, and get back results. And the Flex developer can include a ColdFusion SWC file exposing ActionScript classes and MXML tags via simple abstracted AMF calls. Simply include the SWC in your Flash Builder project, define the ColdFusion name space like this:
and you'll have access to CFML tags within your Flex project. For example, to send an e-mail you could use the following:
The above code creates an instance of the Mail object and names it "cfMail", and sets to, from, subject, etc., with the values of other Flex objects. To actually send the mail all you'd need is to invoke the following (possibly when a Send button is clicked):
There is much more to this "ColdFusion as a Service" functionality, including lots more services exposed, and a sophisticated security model.
But the bottom line is that ColdFusion is now poised to become even more valuable to Flex and AIR developers, and now even of value to developers using other platforms and languages.