|
|
Love Of Coldfusion 8
By Sean Corfield
Expert Author
Article Date: 2007-10-29
Now that Scazu is running on ColdFusion 8, I can finally start taking advantage of the new features and kick off some of my old habits.
One of the things I've found myself doing - much to my surprise, given past pronouncements on this topic - is using <cfscript> more and more. I hadn't expected the ability to use regular comparison (< <= == != >= >) and boolean (|| && !) operators to have such an impact on my coding style!
for (i = 1; i <= n; ++i) { ... }
is just so much easier to read than the alternatives.
I think part of my shift to is driven by the fact that I'm also doing a lot more JavaScript these days as well as increasingly using ActionScript so it's easier to jump from one code base to another if they're all script-based.
I'm even writing entire components in <cfscript>. Did you know you can omit <cfcomponent> inside a CFC? Yes, you can just write a CFC like this:
<cfscript>
function init() { return this; }
function getFoo() { return variables.foo; }
function setFoo(foo) { variables.foo = foo; }
</cfscript>
The equivalent default tag attributes are returntype="any" access="public" on the functions and type="any" required="true" on the arguments. That's fine for a lot of methods but it gets a bit frustrating if you want a private method or you actually want to specify return types or argument types or defaults.
I've also started using type="component" instead of type="any" for my "duck typing" when I know I'm really passing a CFC (there are still many times when I'm passing either a CFC or a primary key - and then using isObject() to see whether I need to load the object from the PK). Writing type="WEB-INF.cftags.component" was just far too much work so I'm glad Adobe added this shorthand type name!
Also, as I mentioned earlier, per-application mappings have been a huge help already on shared hosting.
What little ColdFusion 8 features are you enjoying using on your newly upgraded production systems?
Comments
About the Author:
Sean is currently Chief Technology Officer for Railo Technologies US. He has worked in IT for over twenty five years, starting out writing database systems and compilers then moving into mobile telecoms and finally into web development in 1997. Along the way, he worked on the ISO and ANSI C++ Standards committees for eight years and is a staunch advocate of software standards and best practice. Sean has championed and contributed to a number of CFML frameworks and was lead developer on Fusebox for two years.
|
|
|
|