The Future Of ColdFusion As Blogged By Dan Vega
With commentary by yours truly...
I wanted to point everyone to a short series of blog posts by Dan Vega where he discusses the future potential features of ColdFusion as shown by Adam Lehman and Ben Forta at CFUnited 2008.
The Future of ColdFusion Part 1
The Future of ColdFusion Part 2
The Future of ColdFusion Part 3
Part 3 discusses the Hibernate integration that Adam demo'd during the keynote. I'm particularly intrigued by the prospect of this. For one, the implementation - although extremely early to speculate - looks very nice. I like the fact that it focuses on the objects themselves and not the database or anything else. I'm also intrigued by the possiblity of the object actually generating the database tables though I know some folks are skeptical of this kind of thing (gasp...what happens if I make a typo!!!).
I asked Adam what they had planned for complex objects and composition and he politically deflected the question as a "stay tuned", but since they asked about our feedback, here's how I'd like to see it work:
<cfproperty name="first" accessor="true" hint="First Name">
<cfproperty name="middle" accessor="true" hint="Middle Initial">
<cfproperty name="last" accessor="true" hint="Last Name">
<!--- complex objects (user has many possible email addresses) --->
<!---
emailAddress property would generate three methods:
addEmailAddress (which would append an emailAddress object to the array of objects)
getEmailAddress (returns an array of objects)
setEmailAddress (sets an array of email objects)
--->
<cfproperty name="emailAddress" accessor="true" hint="Email Address" type="Users.EmailAddress[]" />
</cfcomponent>
Adam also displayed a simple method for retrieving the objects - and I don't remember the exact syntax, but it went something like this:
<!--- get an object by it's id: --->
<cfset artist = hibernate.getById(artistID) />
To take this a step further, here is some psuedo code that I dreamed up:
returns an array of objects
whose first name is todd
syntax:
queryByAttributes([attribute],[value])
--->
<cfset artist = hibernate.getByAttributes('firstName', 'todd') />
What about multiple attributes/values?
passing multiple attributes
returns an array of objects
whose first name is todd
and last name is sharp
syntax:
queryByAttributes([list Of Attributes],[list Of Corresponding Attribute Values])
--->
<cfset artist = hibernate.getByAttributes('firstName,lastName', 'todd,sharp') />
What about sorting?
allows selective querying
by attributes and sorting
syntax:
queryByAttributes([list Of Attributes],[list Of Corresponding Attribute Values], [list of sort columns], [list of sort directions])
--->
<cfset artists = hibernate.queryByAttributes('firstName','todd','lastName', 'desc') />
What about accomodating multiple return formats? In this block I'm requesting that the data be returned in query format (which would in essence do a 'left outer join' type query where I'd have multiple rows for each object if they contained one-to-many data):
what about an optional returnFormat
argument (perhaps this should be
defined in the component - assuming they
are planning some sort of skeleton component)
syntax:
queryByAttributes([list Of Attributes],[list Of Corresponding Attribute Values], [list of sort columns], [list of sort directions], [returnFormat: query|array])
--->
<cfset artists = queryByAttributes('firstName', 'todd', 'lastName', 'desc', 'query') />
Wow so that's a lot of speculation and imaginative psuedo code. Most of it just rattled off the top of my head here, so if you disagree or would like to see a different implementation please leave a comment.
As you can probably tell I'm quite excited by this potential feature. I'm remaining a tiny bit pessimistic that the implementation will be what it needs to be given the history of generated code created by some of the Adobe wizards, but I think that those of us who are interested need to be very vocal on what we'd like to see. I also trust that the CFML steering committee will do this feature justice (if they are given input) and I know one or two beta testers who will be extremely hard on the ORM implementation to ensure that it is flawless.






I'm not sure I like that pattern tho'.
What about:
findByAttributes( { firstname = 'todd', lastname = 'sharp' } )
(assuming array/struct syntax was allowed everywhere).
Yep I'm sure it could be polished. Passing a struct of attributes/values could be nice.
What about about passing a prototype object? Something like this:
<cfset user = createObject("component", "user") />
<cfset user.setFirstName('todd') />
<cfset user.setLastName('sharp') />
<cfset users = findByAttributes(user) />
Would match every user that shared the set attributes (this is partially how db4o manages querying).
Much simpler/cleaner, don't you think?
A beautiful Site.
It help me to built my carreer.
Interesting series and many good points.
very nice blog.....
this site is nice and very helpful.
here is an another nice site <a href="http://web-adobe.blogspot.com">coldfusion</a>