CFSCRIPT Only Components

A few weeks ago, Raymond Camden posted an article on his blog: This is ColdFusion – this is ColdFusion 100% in Script – on Bolt. In it he attached a screenshot of Adobe’s planned ColdFusion IDE (Bolt) that has a code snippet from ColdFusion 9 which was a CFC being written in 100% cfscript. In [...]

A few weeks ago, Raymond Camden posted an article on his blog: This is ColdFusion – this is ColdFusion 100% in Script – on Bolt. In it he attached a screenshot of Adobe’s planned ColdFusion IDE (Bolt) that has a code snippet from ColdFusion 9 which was a CFC being written in 100% cfscript.

In case you don’t want to follow the link here is the code that is shown:

component {

 public function void init(){}

 public query function getData(){
    var q = new query();
    q.setDatasource("cfartgallery");
    q.setSQL("SELECT * FROM art where mediaid = :mediaid");  q.addParam('mediaId',value=arguments.mediaid,CFSQLType=CF_SQL_INTEGER);
return q.execute();
 }

}

There are alot of comments on that blog post with people complaining that they don’t want to write their components in pure script. Personally, I think it would be great, coming from a PHP background this just seems to make more sense to me. However consider our current situation with ColdFusion 8.

Currently, I like to use with ColdFusion 8, the below is a snippet from one of my projects that I am currently working on.


 
 q = variables.transferObj.createQuery("from podcast where podcast.releaseDate <= :relDate order by podcast.releaseDate DESC");
 q.setParam("relDate", now(), "date");
 return variables.transferObj.listByQuery(q);
 
 

This code looks very similar to what’s being proposed with ColdFusion 9, most of the above is CFSCRIPT that uses functions from Transfer, and it works very well for me.

I suppose my point in all of this is stop complaining about how you would prefer to write your components, right now you have a choice as to how you want to write your functions at least (CFSCRIPT or tag based) I can only imagine that you’re still going to have all, if not most, of that flexibility with the release of ColdFusion 9.