ColdFusion 9 Released

Last week Adobe announced the release of ColdFusion 9. I am very pleased to have been part of the Beta for CF9 and although I didn't spend as much time as I would have liked on it, my one enhancement suggestion was incorporated in the final release.

What supprised me about the release was that Adobe's marketing of the features in CF9 don't match my list of great new features I have found during the Beta. (I do hope all my favourites are still in the final release!)

Adobe has a list on their web site which has the following headings:

  • Office file interoperability
  • Tight integration with ColdFusion Builder
  • Object-relational mapping
  • Microsoft Office SharePoint integration
  • Enhanced Adobe Flash Platform integration
  • ColdFusion as a Service
  • Adobe AIR local/remote database synchronization
  • New Ajax controls
  • Server Manager
  • Built-in support for portlet standards

It doesn't match my personal list very closely. My top five favourites are:

  • Implicit Getters / Setters
  • ORM Hibernate Integration
  • AJAX UI controls
  • Script Enhancements
  • Implicit Structure and Array improvements

What's your favourite CF9 feature?

Tommorrow eveing at the Thames Valley CFUG I will be presenting an introduction to ORM in CF9 and we will be discussing our favourite enhancements in CF9. Why not come along and find out what CF9 can offer you? It free and I'll even supply some sandwiches.

TVCFUG October Meeting - What's New in CF9?

The ColdFusion 9 public beta release has three main themes:

* Unrivaled developer productivity, * Deep enterprise integration and * Simple work flow with Adobe Flash® Builder™, Adobe AIR® and AJAX to create expressive applications.

At our October meeting we will be discussing what's new, what's good and what's bad in this latest release.

I am particularly interesting to know if you agree with Adobe's choice of the marketing points they are promoting on the new release.

Please register if you plan to come, so that security are expecting you.

I will provide a few sandwiches and as usual Adobe have given us some goodies to raffle.

iPhone Applications in ColdFusion

Last night I watched and interesting presentation, by Joshua Adams of Adobe, showing how to implement certain types of applications using Javascript and ColdFusion on iPhone.

You may think that building applications for the iPhone wouild be well beyond ColdFusion which is a server side technology. The availability of several javascript libraries allow applications written in CF to run with iPhone as a bit more than a basic browser client.

In this presentation by Joshua Adams, you can see how easy it is to make use of some of the features on an iPhone from what is essentially an AJAX application written in CF and Javascript.

If you want to download the slides they are available on his blog.

The presented example application uses nimblekit, a JS framework for the iPhone. This allows access to some of the special features of the iPhone.

Joshua also mentions several other frameworks that would be suitable for use with CF including quickconnect which can also be used to develop apps for the Symbian Platform and PhoneGap for the blackberry.

New stuff in CF9

Ben Forta has posted an article on whats new in CF9. All I can say is that it only scratches the surface of the new features. As soon as I work out what I can say (Non Disclosure Agreement in force) I will post my own list of what I think is good about the new release.

In the meantime what's your favourite new feature? Please let me know so I can plan a TVCFUG meeting on CF9.

Adobe ColdFusion Centaur and ColdFusion Builder Betas on Labs

If you are a ColdFusion user you've probably seen the recent announcements about the upcomming release of ColdFusion 9 (aka Centaur) and ColdFusion Builder. Well if you haven't had a chance to join the Beta program yet and see them for yourself, today is your chance since they are both available today on Adobe Labs.

I have been playing with the Beta for a while now and am impressed by the new features in version 9 which seem to have taken on board a number of suggestions from the community. I'm just hoping all mine get in before the final release.

Behaviour Driven Development with cfSpec at Devon CFUG

I will be speaking about Behaviour Driven Development (BDD) and cfSpec at the Devon CFUG on Wednesday 13th May.

Over the last few weeks I have been preparing a presentation on BDD, mostly to get the ideas straight in my own head. If you are interested in this new way of thinking about development it would be great to see you in Exeter next week.

The meeting will convene at 6:00pm for 6:30 Start at Crisp eBusiness. Map.

I have been enjoying using BDD for the last few weeks and hope to have time to write a blog entry or two about it soon.

Behaviour Driven Development

Following the recent inaugural meeting of the Adobe Web Business group, I was keen to find out more about Agile development and found some really interesting stuff about Behaviour Driven Development.

For me one of the interesting points was simply that it focuses on Powerful questions and getting the words right at the start.

Shortly after the meeting I downloaded cfSpec and began playing with it. Now I am hooked. At that time cfSpec was at version 0.1.1 and yesterday I noticed that it has moved on to version 0.2.1 which is good to see. The first was very usable and the second adds several new features.

I might be a bit late to this party as several other bloggers have already commented on cfSpec.

There seems to be a growing interest in BDD and in particular I see that Sean Corfield is speaking on BDD at cf.objective().2009.

One thing that I have found frustrating is creating tests for old code. To help me do that, I have created an additional custom tag. You can add the generate tag to cfSpec and then simply point it at an existing cfc to create a framework for the cfSpec. Its a bit of a hack but saves me lots of typing because I was fairly good about adding hints to my CFCs.

<cfimport taglib="/cfspec" prefix="">
<generate for="my.cfc.path.cfcname" />

Before I get loads of negative comments, I do realise that this is completly backwards and the wrong way to do the job of creating the tests but its only designed to help when you already have some code and you plan to refactor it. I feel a good first step its to create some tests which can be run after refactoring to prove that the code wasn't broken in the process. Let me know if you find the tag useful.

onMissingMethod and Abstract Object - Part 2

I just did a bit more work on the onMissingMethod handler in my abstract bean cfc.

In case you are interested here are the differences between my implementation and John Whish's original which it was based on.

  • I have improved the code compared to the earlier post.
  • I have made the code work when you have multiple levels of CFC with one extending another. (John's original code only worked at the first level.
  • I have implemented the checking of what is gettable and settable.
  • I have removed the type checking that John put in, as I prefer to be able to load everything from a form into my bean and call validate to find out what is invalid. (You can always put John's checking back.)
Any way here is the code should you want it:

[More]

onMissingMethod and Abstract Objects

I have finally got around to working a bit more on the fusebox scaffolder project. One of the things I have meaning to do was improve the generated code by using an abstract bean and letting generated beans inherit some base methods. I intend to do this for most of the generated cfcs, but just started with the bean as a first step.

I have not in the past used onMissingMethod but now enough of what I am doing is on CF8 that I decided it was worth incorporating in the generated code. I began by reading up about it to see what others had done.

There was certainly lots of ideas out there and I decided to take John Whish's dynamicAccessors.cfc and take it a bit further.

John's idea was to make use of the <cfproperty> tag to set up the properties in a cfc and then to make use of the onMissingMethod in a base cfc to create dynamic accessors. I really like this idea but I also like Peter Bell's idea for controlling the access to the getters and setters through a list of property names.

I was wondering about combining the two ideas and remembered somthing I discovered in the early days of CFCs. You can actaully create your own attributes on many of the CF tags just by adding them to the tag.

So I can write:

<cfproperty name="title" type="string" settable="true" gettable="true"/>
and ColdFusion will ignore my two new attributes in most respects. What it will do is add them to the metadata so I can read them. This allows me to extend John's getAccessors() method to update two new structures one for the setters and one for the getters.

<cffunction name="getAccessors"
         hint="I build a structure of public properties and data types."
         access="public">

      <cfset var metadata = "" />
      <cfset var properties = arrayNew(1) />
      <cfset var index = "" />
         
      <cfif StructKeyExists( variables.instance, "_properties" )
         AND StructKeyExists( variables.instance, "_getable" )
         AND StructKeyExists( variables.instance, "_setable" )
         AND IsStruct( variables.instance._properties )
         AND IsStruct( variables.instance._gettable )
         AND IsStruct( variables.instance._settable )>

         
         <cfdump var="#variables.instance._properties#"/>
         <cfdump var="#variables.instance._gettable#"/>
         <cfdump var="#variables.instance._settable#"/>
         <cfabort/>
         
         <cfreturn variables.instance._properties />
      <cfelse>
         <!--- The first time we get or set a property we need to build a structure of properties and types --->
         <cfset variables.instance._properties = {} />
         <cfset variables.instance._gettable = {} />
         <cfset variables.instance._settable = {} />
         
         <cfset metadata = getMetaData(this)>
         
         <cfloop condition="structKeyExists(metadata,'properties') OR structKeyExists(metadata,'extends')">
            <cfif structKeyExists(metadata,"properties")>
               <cfset properties = metadata.properties />
               <cfloop array="#properties#" index="index">
                  <cfif IsDefined("index.type")>
                     <cfset StructInsert( variables.instance._properties, index.name, index.type ) />
                  <cfelse>
                     <cfset StructInsert( variables.instance._properties, index.name, "any" ) />
                  </cfif>
                  <cfif IsDefined("index.getable")>
                     <cfset StructInsert( variables.instance._gettable, index.name, index.getable ) />
                  <cfelse>
                     <cfset StructInsert( variables.instance._gettable, index.name, "false" ) />
                  </cfif>
                  <cfif IsDefined("index.setable")>
                     <cfset StructInsert( variables.instance._settable, index.name, index.setable ) />
                  <cfelse>
                     <cfset StructInsert( variables.instance._settable, index.name, "false" ) />
                  </cfif>
               </cfloop>
            </cfif>
            <cfif structKeyExists(metadata,"extends")>
               <cfset metadata = metadata.extends>
            <cfelse>
               <cfset metadata = "">
            </cfif>
         </cfloop>
         
         <cfreturn variables.instance._properties />   
      </cfif>
         
   </cffunction>
I now have two new structures in my object which I can use to test if the generated code should allow you to set or get each property.

A small change to the onMissingMethod() function and I can now control who has access quite easily.

What I really want to know is: Am I mad to do this? After all I am arbitarily extending the language and I didn't ask anyones permission.

27Jan 16:25 GMT - Modified to fix a couple of typos.

CF 8 Upgrade

Up until now I had not come across any bugs in CF8 which would force me to upgrade to CF8.0.1, but I did earlier this week.

The bug was in onMissingMethod and came to light when I installed Bob Silverberg's ValidateThis! framework.

I'm running Windows XP and unfortunately my attempt to upgrade to CF8.0.1 failed and I had to do an uninstall and reinstall. The Uninstall also failed which then led me down the horrible route to registry editing. I always feel a little sick when doing things with regedit as its a bit like doing brain surgury in the mirror. One false move and you're dead!

Anyway its all over now and the ValidateThis! demo runs on my desktop machine. I am trying some new ideas in the scaffolding which will build validate this into one of the template sets.

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.