Notes: What’s New in ColdFusion 9
These are notes from Adobe MAX 2009. The talk was given by Adam Lehman.
First, ColdFusion 9 also introduces the new ColdFusion Builder product, an Eclipse-based IDE “to rule them all”. Because it is based on Eclipse, you can also combine other products, like Flash Builder, so that one IDE gets the job done for everything, whether it is HTML, CFML, JS, Flex, ActionScript, CSS, etc.
ColdFusion Builder also supports some interesting server integration features. You can access ColdFusion Administrator and other functionality right from ColdFusion Builder; you can see and browse all of the databases that ColdFusion has datasources for. With such functionality, you can do cool stuff like auto-generate ORM-based CFCs by pointing it to an existing database table! Now, it doesn’t generate just the bean CFC. It generates the entire service layer: DAO and Gateway beans as well!! Now, this obviously is just a starter step. It’s expected that you’d tweak it from that point. With the Flash Builder integration, you can take this to the next step by also generating ActionScript objects to help with Flex integration as well.
CFML Enhancements
Well, in CF7, they introduced Application.cfc that supported hooks for application events. But now in CF9, there is a Server.cfc with an onServerStart() method for handling that event.
Various other holes have been filled. You can now have nested CFTRANSACTION tags. Error catching now supports “finally”. And looping now supports CFCONTINUE.
Variable level enhancements: You can now pass implicit structures/arrays to tags and functions. Before you had to assign it to a var and then pass it. There is assignment chaining (a=b=c). Direct access to elements of returned arrays (i.e. myFunction()[x] couldn’t be done previously). And, finally, ternary operators! For instance, you can do something like: a = (b<c)?b:c
CFSCRIPT enhancements. Starting in CF9, you can now write 100% script-based code, including classes/components.
CFC enhancements. There is now an explicit LOCAL scope. Instead of doing var myvar=1, you can do LOCAL.myvar=1. What’s more, you can declare a variable with var anywhere in the code, not just at the top. CFCs also support implicit getters/setters by using the CFPROPERTY tag. These are worth using if there is no special handling going on, because they’re 7x faster than your own getters/setters.
Here’s an awesome feature. You no longer have to use CreateObject() to create a CFC. You can use the IMPORT keyword to point to a directory of CFCs and have them be first-class citizens in your code. And you can use the NEW keyword to create CFCs, like user = new User(). Looking more Java-like all the time.
How to convince your boss to upgrade
First, with CFIMAP, you can now access email with IMAP support, such as GMail.
There are many PDF support enhancements. Create PDF packages, add/remove headers and footers, optimize PDFs (down-sample images, for instance), extract text/images, high-quality thumbnails, convert Word documents to PDF.
There are presentation options. The CFPRESENTATION tag will generate PPT files from CFML/HTML content. And you can go the other way: Convert PPT to HTML or Flash. Supports Microsoft PowerPoint ’97 to ’08 and Open Office Presentations.
Spreadsheet support. The CFSPREADSHEET helps you create, read, and merge native Excel spreadsheets. This isn’t just a CSV file. This is a real Excel spreadsheet with formulas and formatting support.
SharePoint integration. Native access to SharePoint data and services (Sites, templates, sub-sites, web parts, and workspaces). You can get lists including data, views, and alerts and querying against lists. Users, permissions, site groups, cross-site groups, security groups, and distribution groups. Build web parts with CFML. Integrate with SharePoint Single sign-on. You may wonder, “Why is this necessary since SharePoint has web services and exposes information as XML?” Because it’s painful. ColdFusion makes it significantly easier and faster.
ColdFusion Server Manager. A Flex-based AIR application that helps you manage multiple ColdFusion servers. And it receives system notifications and alerts. Helps apply settings for multiple servers.
The next generation of applications
Coldfusion 9 ORM functionality. Powered by the Java Hibernate framework, so it is industry standard. Various ormXXX() and entityXXX() functions provide this functionality for you. With this feature, no more SQL is necessary, so apps can be developed faster (and potentially with fewer errors). CFCs will just be automagically saved. But it’s not just a matter of saving time on development; it also makes it so that your app is no longer database-dependent. It can point to any database server and it should just work.
Enhanced caching. ColdFusion is already pretty optimized for speed (esp. between CF7 to CF8). So to get more speed, developers need to use these new caching features. Using cacheGet(), cachePut(), and cacheGetMetaData(), you can save/retrieve objects from a built-in cache. Page fragment caching allows you to have a combination of static and dynamic content on a page. This provides a HUGE performance boost, depending on what you’re doing. For instance, you only want to generate a menu dynamically the first time, but then another area of the page is dynamic every time.
Performance gains. Okay, Adam lied. ColdFusion 9 is actually 40% faster than ColdFusion 8, with no changes to code, just upgrading ColdFusion. CFC creation is 8x faster, method invocation is 3x faster. And UUID creation is 100x faster. These are some huge bottlenecks that have been blown away. There is a performance brief that Adobe will be releasing on ColdFusion 9 in the near future.
Search engine. ColdFusion 9 now includes Apache Solr. Verity is still included, but so is Solr, which is actually even faster than Verity. So you may choose to upgrade to Solr! They even provide a Verity-to-Solr migration utility.
ColdFusion Server API. You can have direct access to ColdFusion services for CFCHART, CFDOCUMENT, CFPDF, CFIMAGE, and more. This makes it even easier to access ColdFusion mail/pdf/images services directly within Flex without having to custom code some ColdFusion code.
What’s more, Flash Remoting is 9x faster. It may arguably be the fastest flash remoting server-side technology around.
There are various JavaScript/Ajax tags, like CFMAP for Google Maps, CFMESSAGEBOX, CFSLIDER, and more. Ajax functionality in CF is powered by ExtJS 3.0 (which is nice, because ExtJS isn’t free anymore, so getting CF9 gets you a copy of ExtJS basically), and JQuery is also supported.
This presentation was very rapid fire, which is testimony to how feature-rich of an upgrade ColdFusion 9 is.
