Wednesday, August 5, 2009

ColdFusion 9 Wishlist

After playing around with ColdFusion 9 for a little bit, here's my wishlist for future enhancements:

• If you run entityLoadByPK("User",1) and there isn't a User with an ID of 1, it would return an empty User. Either that or add a new method, entityGet("User",1), that would accomplish the same result.

• Add cacheExists(key) that would check to see if a certain key exists in the cache. You can currently use cacheGetAllIds() to return an array of all the keys, then use arrayFind(), but that's a little tedious.

• Allow the ORM event handlers preLoad(), preInsert(), preUpdate(), and preDelete() to return a value or prevent the actual event (load/insert/update/delete) from firing. This would allow you to fetch from the cache before hitting the database a lot easier.

• Add syntax support for dynamic method invocation, similar to user["get#property#"](). You can get around this by using <cfinvoke component="#user#" method="get#property#" />, but it's so verbose.

• Add an implicit "instance" scope to components to keep instance data separate from methods, then update the implicit getters/setters to reference the instance scope. That way, if you wanted the component's instance data (aka memento), you could simply return the instance scope.

• Add support for <cfloop query="#users#" index="user"> where user would be a struct containing the current row's data.

• Add support for <cfloop collection="#users#" index="user"> rather than having to use item="user".

• When looping over a struct, it should loop the keys in alphabetical order. Yeah I know if you want a collection to maintain an order, you should probably use an array, but looping alphabetically is better than looping arbitrarily. This would come in handy when working with API's that use the OAuth protocol.

• Allow you to set the default output value to "false" for all components and methods. Not sure why the default value is "true". Doesn't make much sense.

• Allow you to select a setting to automatically trim all form/url variables. I hate trailing whitespace...

• Maintain the case of keys in structs. Kinda lame how user.name turns into user.NAME but user["name"] stays like it should.

That's all I can think of for now. And although it might appear like I'm complaining a lot, I'm actually really excited about CF9. Lots of good stuff ahead.

1 comment:

Note: Only a member of this blog may post a comment.