the singularity of being and nothingness
Turning to the Darkside…of <cfscript>
During a lull at work the other day, I was reading about the extended capabilities that have been added to <cfscript> in ColdFusion 9, like being able to create queries and entire components…
Honestly, until recently I've not really used a whole lot of . I'm not really sure why…just not something that interested me a whole lot. You think it would: I like JavaScript syntax a lot, and translating these skills to <cfscript> is pretty straightforward. Still, not a whole lot of experience.
Honestly, I think a lot of it is that there's something comforting about the tag syntax. It's easy to see a balance in your code, and even easier–depending on your IDE–to see where you've completely borked something, left out a tag…whatever. Some of it, out of necessity, is that not every tag has a equivalent, although efforts are underway to remedy this…Whatever the reasons might be, it's super-simple to get used to the tags and then feel quite lost in <cfscript>.
The revelation for me was kind of interesting. For starters, outside of the very specific tags like, say, <cfexecute>, what are the majority of the tags that you use in a regular swatch of code? For me, it's a LOT of <cfset> and <cfif>. What struck me when I started looking at these, however, is that even though I'm using a 'tag' to "wrap" the variables and values that I'm messing with, the rest of my operation is…what? A ton of functions! ListLen(), isDefined(), ArrayNew()…all of these have ABSOLUTELY NOTHING to do with tags whatsoever!
Yes, I know, it's painfully obvious. However, this realization completely slapped me in the face. If the vast majority of my code is not really dependent on these tags at all, why waste the keystrokes on all those greater-than and less-than signs?
Well, I'll be honest. After about 5 minutes with <cfscript>, I was hooked. Outside of very specific needs (remember, tags CANNOT be used in a <cfscript> block…), this is what I'm using from now on. It's faster to write, takes up less space, and just feels a little more like I think a bit of code should. That's enough for me. And given that each new version of CF continues to bring on more capabilities for this method, I feel like I'm on the right track.
Print article | This entry was posted by existdissolve on January 22, 2010 at 8:05 pm, and is filed under ColdFusion. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |