Bluemini.comBluemini.com

Simon Horwith

ColdFusion Performance and Recursion - More Good N

posted: 31 Dec 2010

In my last post (http://www.horwith.com/index.cfm/2010/12/17/coldfusion-performance-and-language-abstractions-railo-shines) I ran some simple code to test the efficiency of the ColdFusion compiler and runtime. Specifically, I was attempting to test whether or not the server generates optimal byte code when dealing with abstractions and, if not, to identify any performance degradation as a result of choosing one means of abstraction over another. I also ran the same tests on Railo and was quite surprised by the results when Railo blew away all of the other test results on the one test that the Adobe CF server could barely handle at all. So I started thinking about what other tests I could run to test server/compiler efficiency. Because the first tests focused on abstractions, I thought it would be fun to end the year with a test of the efficiency of ColdFusion when developers use recursion.
I start with a baseline. It took 0 milliseconds on average to get the length of an array that has 1,000 empty items using the arrayLen() function. The code looks like:
theArrayLen = 10000; aFoo = arrayNew(1); arrayResize(aFoo, theArrayLen); start = getTickCount(); numItems = arrayLen(aFoo); end = getTickCount() - start; writeOutput('It took ' & end & ' ms to get the length of an array with ' & numItems & ' items in it using the built in arrayLen()');
Then I wrote the code to recurse and calculate the length of an array with 1,000 empty indexes - the code averaged about 30 milliseconds to run on my laptop. That code looks like:
theArrayLen = 1000; aFoo = arrayNew(1); arrayResize(aFoo, theArrayLen); start = getTickCount(); numItems = getArrayLen(aFoo); end = getTickCount() - start; writeOutput('It took ' & end & ' ms to recursively get the length of an array with ' & numItems & ' items in it');
When I tried making 10,000 recursive calls, ColdFusion almost immediately just returned a completely blank screen. No error, nothing, just an empty response.
Some language compilers have the ability to optimize bytecode when you use a technique called tail-recursion. Tail recursion (or tail-call recursion as it's sometimes called) code is recursive code in which the last thing the function executes is a recursive call. This allows the compiler to generate code that does not require putting all the recursive calls on the memory stack and is much more efficient that building and then unwinding the call stack. So, I tried writing the code to use tail-recursion like so:
theArrayLen = 1000; aFoo = arrayNew(1); arrayResize(aFoo, theArrayLen); start = getTickCount(); numItems = getArrayLen(aFoo); end = getTickCount() - start; writeOutput('It took ' & end & ' ms to tail-recursively get the length of an array with ' & numItems & ' items in it');
Again, the code averaged 30 milliseconds to run. Before dismissing CF as unable to optimize for tail-recursion I took a closer look at the code and it occurred to me that the last thing the recursive call is doing is executing a CFRETURN, not the actual recursive call. So I rewrote the code to be tail recursive as best I possibly could, which required me to do a little dirty programming (no longer functional in nature, the new version is imperative and uses the side effect of modifying a variable in memory). Unfortunately, the average execution time remained 30 milliseconds. That code looks like this:
numItems = 0; getArrayLenHelper(arguments.theArray); if (not arrayIsEmpty(arguments.theArray)){ numItems++; arrayDeleteAt(arguments.theArray, 1); getArrayLenHelper(arguments.theArray); } theArrayLen = 1000; aFoo = arrayNew(1); arrayResize(aFoo, theArrayLen); start = getTickCount(); getArrayLen(aFoo); end = getTickCount() - start; writeOutput('It took ' & end & ' ms to tail-recursively get the length of an array with ' & numItems & ' items in it');
ColdFusion does not appear to be able to optimize the bytecode it generates for tail-recursion. In my last entry, I went ahead and ran all my tests on Railo, with some surprising results. So I went ahead and ran my recursion tests on Railo locally again.
Looping without recursion averaged 0 milliseconds with CF, and with Railo it also averaged 0 milliseconds. My "normal" recursion test averaged 30 milliseconds on CF, but on Railo it averaged 5 milliseconds - clearly a better result. When I increased the number of recursive calls to 10,000 Railo also couldn't handle it but unlike CF, Railo actually told me what was wrong (in the form of a stack overflow error screen). My first attempt at tail recursion, which averaged 30 milliseconds on CF, averaged 5 milliseconds on Railo - so like CF there was no change and the execution time of the second tail recursion test which again took 30 milliseconds on CF also didn't change on Railo and took 5 milliseconds. Presumably, Railo is either using a better data structure or creates a more optimal execution path for recursion. Though Adobe ColdFusion and Railo appear to have similar constraints (using their default server and JVM settings anyway), Railo clearly outperforms the Adobe server when recursive code is present. The memory footprint and usage was also massively superior with Railo - during these tests CF would consume as much memory as possible and would collapse when not happy. More good news for Railo users... at least for those who write recursive code.

Several people wanted to know a little more about the environment I ran these tests in (my development laptop), which I posted in a comment on my last thread and will specify here:
My laptop is running Windows 7 Professional 64 bit with a Intel Core i5 CPU M520 @ 2.4 GHz and 8 Gigs of RAM. I'm running Adobe CF 9,0,0,251028 in standalone mode (integrated JRun) with no serial number. I'm running Railo 3.1.2.001 final using integrated Resin. I did not modify the settings or default JVM on either server after installation and tested using the built-in web server and application server for both. Note that this means the CF JVM had twice as much memory available but in my recursion and abstraction tests Railo used a MUCH smaller footprint even when running more laborious tasks than CF.

ColdFusion Performance and Language Abstractions -

posted: 17 Dec 2010

Not too long ago I posted a few entries describing some of the features, changes, and improvements I'd like to see made to ColdFusion as well as some of my concerns/complaints (see http://www.horwith.com/index.cfm/2009/7/16/another-open-letter-to-the-coldfusion-server-team, http://www.horwith.com/index.cfm/2010/1/6/can-coldfusion-handle-enterprise-applications, http://www.horwith.com/index.cfm/2010/5/11/a-few-thoughts-about-various-programming-languages, and http://www.horwith.com/index.cfm/2010/2/25/standardizing-coldfusion). A recurring theme is desire for more control over how the server compiler works and the fact that sometimes the server doesn't do what you want or expect and because it's a closed-box, developers have little or no recourse. A developer friend of mine recently asked me what my point was, exactly, so I put together a few code samples and thought I'd write about them.

My objective in these code samples was to test the efficiency of ColdFusion when using abstractions. The following code illustrates behavior that I believe reveals an inefficiency in the the way that ColdFusion compiles, or uses compiled, code. I have three test pages - all three have a cfscript block containing a 'for' loop. All three were run on ColdFusion 9 on my laptop. The first page loops and does nothing at all, then outputs how long it took to loop 'x' times. On my laptop the average time it takes to loop 1,000,000 times and do nothing is about 150 milliseconds. That code looks like this:
numLoops = 1000000; start = getTickCount(); for (i = 1; i lte numLoops; i++){ } end = getTickCount() - start; writeoutput('looping ' & numLoops & ' times and doing nothing took ' & end & ' ms');
My second test page is exactly the same as the first, but it has a function defined on the page. The function does nothing, and inside the loop I call that function. On my laptop the average time it takes to loop 1,000,000 times and call a function that does nothing is about 700 milliseconds. That code looks like this:
function doNothing(){ } numLoops = 1000000; start = getTickCount(); for (i = 1; i lte numLoops; i++){ doNothing(); } end = getTickCount() - start; writeoutput('looping ' & numLoops & ' times and calling a function that does nothing took ' & end & ' ms');
The page that calls a local function takes about 5 times longer on average. Though the immediate reaction might be "Of course - after all, it's calling a function" that's just not right. Better put, it's just not efficient. In simple terms, the server is just a compiler - it turns CF pages into java bytecode and it executes that code to respond to requests. There's no reason why the compiler, after building a parse tree, etc., can't do a better job optimizing the byte code. In other words, the byte code generated for calling the function that does nothing should be identical to the bytecode for doing nothing. Obviously, when code is parameterized and/or has behavior that is dynamic in some way, it's not so straight-forward.
My third test page is exactly the same as the second, but I moved the function to a CFC, create one instance of the CFC before the loop, and inside the loop I call that function on the CFC instance (it's the same function, which does nothing). On my laptop the average time it takes to loop 10,000 times and call a function that does nothing on a CFC instance already in memory, is about 2,000 milliseconds. That code looks like this:
objComp = createObject('component', 'testcomp'); numLoops = 10000; start = getTickCount(); for (i = 1; i lte numLoops; i++){ objComp.doNothing(); } end = getTickCount() - start; writeoutput('looping ' & numLoops & ' times and calling a CFC method that does nothing took ' & end & ' ms');
and the CFC code looks like:
function doNothing(){ }
So - looping 10,000 times and calling the CFC method averages almost three times as long as looping 1,000,000 times and calling the same function locally. There is a valid argument that it's more difficult for the compiler to optimize the same way for the CFC method because now it's in a shared place (a CFC) so the compiler would have to find every call to this method everywhere on the server and recompile those files in order to replace the method calls with the equivalent byte code - which could be done but it is ugly, yes. That said, I'm still at a loss as to why the performance degrades so much just because the method is being called on a CFC instance. That implies to me that either CFCs are very inefficiently compiled or that the process the server uses for accessing and/or locating methods and variables is not efficient (in LISP this would be a/the Read Table but I'm not quite sure exactly how CF/Java handle it). My CFC method code, when looping 100,000 times, would time out... I didn't bother trying to loop 1,000,000 times and call a cfc method.
I'll state for the record that I'm not an expert compiler-writer but I've read a lot about how compilers work and how to write them. I am an expert software developer by some definitions (I hate to call myself an 'expert' anything, but after doing this for more than 15 years it's fair to say I'm not a novice), which makes me an expert compiler-user. Besides, a compiler is still software, so I think it's fair to say that I'm qualified enough to make theses observations and offer some speculation.

One thing that a skeptic might immediately point-out in opposition to my examples is that they're not practical. After all, isn't it fair to say that you're unlikely to write code that is so static let alone that does nothing at all? I'll admit that encapsulating code that does absolutely nothing IS a stretch - but I'd argue that well-architected code SHOULD contain a good deal of functions that are essentially static. Static in the sense that they either always return the same value or that given the same input they will consistently return the same result with no side-effects. This is one of the characteristics of code that's been written in an expressive style because of the use of abstractions... and it is the staple trademark of applications written in a functional style. Abstractions are one of the most powerful tools in software development (functional or otherwise), and often times the most under-utilized by developers (especially web developers). So, here is a different version of the first and second tests I described earlier - this time the code from both tests does SOMETHING. The first test loops 1,000,000 times and sets a variable equal to the sixth character in a string contained in another variable. On my laptop the average time this takes is 175 ms - barely longer than the time it took to loop 1,000,000 times and do nothing. The code looks like this:
numLoops = 1000000; tst = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; tst2 = ''; start = getTickCount(); for (i = 1; i lte numLoops; i++){ tst2 = mid(tst, 6, 1); } end = getTickCount() - start; writeoutput('looping ' & numLoops & ' times and setting a variable to the sixth character took ' & end & ' ms');
The code in my second test uses a function to abstract the task of retrieving the sixth character from the string. Note that as before, there's no reason why the server shouldn't generate the same byte code as my last test. On my laptop the average time it took to loop 1,000,000 times and set a variable to the return value of a function call that outputs the sixth character from a string is 1,000 ms, which is a comparable degradation to what I saw in the first two tests that did nothing. The code for this second test looks like:
function getSixth(str){ return mid(str, 6, 1); } numLoops = 1000000; tst = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; tst2 = ''; start = getTickCount(); for (i = 1; i lte numLoops; i++){ tst2 = getSixth(tst); } end = getTickCount() - start; writeoutput('looping ' & numLoops & ' times and calling a function to set a variable to the sixth character took ' & end & ' ms');
The conclusion I draw from these tests is that using abstractions to build your ColdFusion applications comes at an hefty price. This is unfortunate in that for the sake of performance, a developer is discouraged from expressing the intent of a program with readable reusable code in an optimal way.

Though Railo is not a black box in the same sense as the Adobe ColdFusion Server (since Railo is Open Source), I haven't had time to read the source so for the purposes of this writing let's pretend it is. So what happens when I run the exact same code on Railo on my laptop?
The first test file that loops 1,000,000 times doing nothing averaged 150 milliseconds on CF. On Railo, it averaged 450 ms... more than three times longer. My second test that loops 1,000,000 times and calls a function that does nothing averaged 700 milliseconds with CF. On Railo the average time to run this code was 850 milliseconds... not much longer than CF and certainly no where near the performance degradation I saw between test 1 and test 2 with CF. So I'm beginning to guess Railo is a slightly slower server than Adobe CF but doesn't degrade so poorly. Let's try my last test. On Adobe CF it took 2,000 milliseconds to loop 10,000 times and call a CFC method that does nothing... and the server choked if I tried looping 1,000,000 or 100,000 times. On Railo, looping 10,000 times and calling the CFC method took 24 milliseconds. Yes, that's right - 24 milliseconds! I'm not sure but my assumption is that the Railo server is either taking advantage of multi-threading or isn't building a call stack when accessing the CFC method. Whatever the case, the Railo server appears to reward developers for using abstractions... in a very big way. This is something I intend to research in much more depth, as any compiler/runtime environment that is optimized for code that makes use of abstractions is a much more desirable platform. I should note that looping 100,000 times on Railo and calling the CFC method averaged 430 milliseconds, but Railo also choked on 1,000,000. I also ran my two tests that actually do something and, as I expected, Railo was consistent with its earlier behavior. The inline version, which took CF 175 milliseconds took Railo an average 800 milliseconds. The version which calls a function that does something took ColdFusion an average of 1,000 milliseconds and took Railo an average of 2,000 milliseconds.

I should mention that I kept both application servers running locally during all of the tests and that I used the plain vanilla default installation for both CF and Railo. No CF or JVM settings were modified in any way. I can't explain why Railo appears to be slower than CF when all your code in in one file any more than I can explain why ColdFusion is so inefficient when you use CFCs. Perhaps the application server chosen for a project should be determined by the style and architecture of the code it will run? Or perhaps code should be refactored and/or optimized to take advantage of the Application Server on which they reside? If anyone from the Adobe CF or Railo server development teams cares to comment on my findings, I'm all ears.

Shortcut Evaluation and Lazy Programming

posted: 13 Dec 2010

As I've said before, I like to spend what little free time I have programming in LISP for fun. Every programming language has at least a few "unique" features that the users of that language love and think is the best thing since sliced bread - in the case of LISP, one of several of these features is the fact that EVERYTHING returns a value (yes, even declaring a variable or printing something to the screen). Because of this, you never explicitly return anything from functions in LISP - the value of the last statement IS the return value, whether you like it or not. In fact, most LISP developers prefer to think of their functions as "evaluating" to a value, rather than "returning" a value. This language feature leads to some interesting best practices and programming techniques - one of which I've not only come to enjoy when writing LISP code but was happy to discover also works well in CF. I'm refering to the practice of letting the Boolean logic statements ('and' and 'or') return values for you, rather than writing conditional logic in the form of 'if' statements.

You probably already know that 'and' and 'or' use shortcut evaluation. In the case of 'and' each argument is evaluated left to right until one of them returns false, then any other values aren't evaluated. In the case of 'or' each argument is evaluated until one of them returns true. The operative thing here is that "each argument is evaluated". The code '2 and 3' will evaluate 2, which is a Boolean 'true', then 3, which is also 'true'... so though the statement would typically be used in a Boolean context, technically what it returns is the last evaluated statement, which in this case is '3'. If the statement was '2 or 3' then 2 would evaluate as itself, which is a Boolean 'true' and would be returned immediately without the 3 ever being touched by the runtime. Yes, 'and' and 'or' statements return a value... specifically they return the value of the last value they evaluated when looking for Boolean fragments. In LISP, it's not uncommon for the last statement or even the entire body of a function to simply be an 'and' or 'or' statement.

The easiest way to illustrate this is with code. Often times, a variable should be set to the value returned from a query or to zero if the query returned no rows. This is a simple but common occurrence in applications. Note that I used CFSCRIPT to write the code, but these samples work the same way using CFSET and CFIF statements.

First, let's look at how the average developer would solve the problem:
qFoo = queryNew('id,somecols'); if (qFoo.recordCount){ id = qFoo.id[1]; } else { id = 0; } Your ID is #variables.id# Perhaps the developer is thinking ahead a bit and uses this shorter version instead:
qFoo = queryNew('id,somecols'); id = 0; if (qFoo.recordCount){ id = qFoo.id[1]; } Your ID is #variables.id# On the other hand, by taking advantage of short-cut evaluation you could use a single line of code:
qFoo = queryNew('id,somecols'); id = qFoo.recordCount and qFoo.id[1]; Your ID is #variables.id# Whether or not this last approach is better is arguable because some developers will not immediately understand what it does... and less readable code is worse than readable code. However, to a developer used to this technique there's nothing not-readable about it all, and it's condensed and clean. In case you're wondering, the performance of this technique is great - in more complex examples I was unsuccessful creating any performance degradation... and was often times able to speed code up by using values set this way inside of loop controls.

Functional programmers sometimes optimize their code using a technique called "Lazy Programming" in which calculations aren't actually performed until needed, in order to optimize their code. It's a wonderful (albeit unusual) style of development and in ColdFusion, taking advantage of the shortcut evaluation behavior of 'and' and 'or' is the cleanest and only natively supported way to make your code "lazy".

Happy Holidays!

posted: 05 Nov 2010

It's a double-wammy today... celebrating both Diwali and Guy Fawkes Day.
I imagine England's going to be very lit-up tonight.

Happy holidays, everyone!

Help Wanted: PHP, .NET, ActionScript... and ColdFu

posted: 24 Sep 2010

Nylon is hiring again. We definitely need a strong PHP developer, maybe two, and it's looking like we're going to need to add a decent .NET developer to the team as well. Any experience with ColdFusion or ActionScript is also a plus.

Anyone interested, or who knows someone that might be interested, should send their availability, resume, and salary requirements to shorwith@nylontechnology.com. All positions are full-time and on-site in our office in NYC.

Introducing Neel Horwith

posted: 20 Sep 2010

Apologies, I didn't get any posts out before my son arrived. I'm happy to announce the birth of Neel Badhwar Horwith on Sept. 13, 2010. Mother and baby are doing great.

Breaking Radio Silence

posted: 20 Aug 2010

I've been really busy with work... but I'm still alive... and I have a few thoughts that I've jotted down with a note to blog about them, so I'll be blogging more in the very near future.
My wife's expecting our second son any time now... so I'll try and get some posts up before I become completely busy with bottles and diapers (again).

php.org is written in ColdFusion

posted: 21 Jun 2010

I just thought it was too surprising and funny not to post - http://php.org/ appears to be written completely in ColdFusion.

Doh!

A Few Thoughts About Various Programming Languages

posted: 11 May 2010

In my role leading development shops, I am constantly having to learn and evaluate new programming languages and tools in order to keep us current as well as in order to discover better ways to accomplish goals. As a developer, I am also constantly learning simply because I want to get better at what I do, I love what I do, and learning new languages is a fun and rewarding undertaking. From time to time, someone writes a blog entry or gives a conference presentation about the importance of knowing more than one language... of not being a 'one trick pony'. I was reading Sean Corfield's recent blog post about Clojure and realized that I've never written about my recommendations or opinions of various languages that I've used or evaluated... until now. In no particular order, here are several of the technologies that I know and my thoughts about them:

  • Python
    • I've recently been spending a decent amount of time learning and using Python - it's very fast and powerful, and is syntactically one of the most concise and elegant languages I've ever seen... it's VERY readable and the more I use it, the more I like it. Python is definitely one of my favorite languages.
  • Java
    • I've used Java off and on since 1995, and somehow keep ending-up having to use it on projects from time to time. The language has gotten larger, faster, and for the most part, better over the past decade and a half - I found the language improvements in Java 5 particularly useful in that they clearly tried to make it easier to do what you want in your code. That said, I don't find Java programming particularly clever or challenging and on many projects I see, deployment is a terribly painful process. Java applications tend to have ridiculous file/directory structures and I'm not a huge fan of how strict it is. Java is everywhere and does have a huge job market, so it's worth knowing for those reasons... but it would never be my first choice of languages to use based on any merits other than the large talent pool and number of open source projects.
  • PowerShell
    • Powershell is probably the coolest new thing I've seen in a long time. For those of you unfamiliar with it - it's a fully OO scripting environment for Windows (runs on .NET) and is free from Microsoft. The syntax is slick and simple, and the power you can pack into a single line of code makes it a no-brainer for anyone who needs or wants to administer a Windows network or machine. With powershell, windows finally has a shell that's better and more powerful than those available on nix systems. Bottom line: if you use Windows you REALLY should learn Powershell.
  • PHP
    • PHP is yet another free technology - we use PHP and CF for most of our projects, and I like PHP a lot. A long time ago, some people called PHP "poor man's ColdFusion"... well, I think it's more true today than it was back then. It's simple, lightweight, and fast... and development times really aren't much longer than with CFML provided you're not trying to do something that CF does out of the box that there's no PHP module to do. I don't see it having many advantages over CF aside from price, the huge talent pool, and the number of open source projects. There's a good job market for PHP but those jobs don't typically pay as well, so I'd learn it because of it's popularity but I wouldn't choose a career focused exclusively on it.
  • Flex/ActionScript
    • I've used Flex since beta 1, and I enjoy seeing how it evolves with each new release. I don't particularly like programming with ActionScript for the same reasons I don't like Java - but unlike Java, I do love the end result you get with Flex... enough to want to do it. No technology to date that's tried to compete with Flash has been compelling enough to use in lieu. There's also a great job market for Flex - especially here in New York City, and it's one of the top 3 or 4 technologies I'd recommend learning to anyone who wants a successful web development career right now.
  • ColdFusion
    • I've used CF since the beginning and continue to use it heavily. It's not the best performing technology available but it performs well enough for most needs. No, it's not free, but development/debugging time is rapid enough to easily justify the cost. These days, CF's closed architecture and code base is a real turn-off for me personally, but it's the lack of talent (and the poor quality of most "talent") that is it's only solid turn-off from a business perspective. The native support for Flex is probably its most compelling unique feature... that, and it's rapid development nature. It's a good choice when you want a very robust user-friendly platform in a turn-key solution.
  • LISP
    • LISP is, hands down, personally my favorite language. Five or six years ago I set-out to spend 6 months of my free time teaching myself LISP, and I enjoyed it so much that I just never stopped. The syntax took a little getting used to, and emacs takes even longer to get used to - which is probably the most annoying part of learning LISP (I haven't found a better free IDE for LISP yet). LISP is beautiful in the simplicity of its design - most notably in the interchangeable nature of code and data. It is definitely the most expressive and flexible language I've used - as well as the most powerful. Be warned; it takes a while to un-train yourself and learn how to really harness the power of LISP (particularly of macros and, if you're new to it, thinking in functional terms). I also, surprisingly, find the implementation of OOP in LISP (CLOS) much nicer and cleaner than that of any other language. I strongly recommend learning LISP. Not because there's a huge job market for it (there isn't) but because it puts other languages into perspective and because it WILL make you a better developer (I've learned more from 'tinkering' with LISP than any other language).
So, those are the main languages I've played with and developed feelings for recently (within the past 2 years). It's worth noting that there are other languages I left off for brevity. I've also been getting back into JavaScript these days - I have a new appreciation for it's functional nature and closures, and I think JQuery is pretty slick. I've taken a pretty good look at Objective C - it's a decent language but not worth learning unless you want to do a lot of Apple development. I've also played around with Clojure - which is essentially a pseudo-LISP implementation for the JVM - I liked it, but prefer to use 'pure' LISP... though it's attractive being able to write LISPy code that I can run on a JVM, since Java is everywhere. There are a few other languages I haven't had time to take a good enough look at yet but hope to very soon. Specifically, I'm interested in looking at Scala and Caml... and I've begun learning some Haskell and hope to dig into that a little deeper.

Apple vs. Adobe

posted: 09 Apr 2010

Apple Wins :(
http://www.googlefight.com/index.php?lang=en_GB&word1=Adobe&word2=Apple
Yes, that really is all I'm going to say about the current Apple/Adobe war... except for a big shout out to Lee Brimelow for speaking his mind (http://theflashblog.com/?p=1888).
Right on, Lee!

Happy Pi Day!

posted: 14 Mar 2010

Yeah, it's geeky... today's date is 3.14, so Happy Pi Day!
http://www.piday.org/

Standardizing ColdFusion

posted: 27 Feb 2010

I recently wrote (http://www.horwith.com/index.cfm/2010/1/6/can-coldfusion-handle-enterprise-applications about the lack of predictable behavior in CFML - something that I think is a terrible shame and is personally my biggest complaint about the product. I was a little worried that this sentiment isn't being expressed too often or with much vocal strength by many other developers, but was happy to read Alan Williamson's recent post on the topic at http://alan.blog-city.com/cfml_conventional_wisdom.htm. Alan went a step further and created a Google Group for the topic as well.
When defining a language there are two traits to be concerned with: syntax and semantics. I'd like to see an Extended Backus?Naur Form (EBNF) definition for the language syntax. This would give developers a reliable syntax specification for the language, engine implementors a specification to code off of and the ability to claim compatibility with an official language version, and IDE developers an easy industry approved method for syntax recognition. Semantics, i.e. the meaning behind the syntax, is more difficult to define and there are several languages for doing so (all essentially based on mathematical notation and logic). I don't know whether we need a formal semantics definition or if a more 'plain English' language specification or hyperspec would suffice. My guess is that a plain English language specification would serve the purpose (similar to the ANSI Specification for Common LISP or SQL).
The issue in any event, is that Adobe owns the most original and most popular ColdFusion Server on the market, so without their support I have to question the usefulness of any specification - syntactic or semantic. Remember how difficult it was to code cross-browser sites in the 90's because Microsoft and others refused to strictly enforce support for the official HTML specification? You ended up having to do all sorts of crazy hacks from browser to browser. Well, that's essentially what's happening, and will continue to happen, to server side CFML unless all the server vendors agree to support some common langage definition.
It's time for Adobe to decide whether or not they want ColdFusion to be a platform that rivals the other server-side web technologies not only in capabilities but in popularity, or if they want to continue developing it as a proprietary product with a niche following. They do a fine job innovating the product and integrating it well with Adobe (and other) technologies, but in today's IT world I don't think that's enough. If the community of developers and customers is to significantly grow and thrive, the evolution of the platform must be driven by an open group. This model worked for Java and for PHP... and I believe it is the key to ColdFusion's ensured success for many years to come. I'm not suggesting Adobe gives the server away, nor that they couldn't add proprietary extensions in order to give themselves competitive edge (as I'm sure other vendors also would), only that the product should be one of a group of products from various vendors who are all adhering to one specification and who support a unified customer base. I know that, especially for Adobe, it's just not that easy... but it's also not impossible. I'd love to see someone from Adobe chime in on this topic.

State of CF in India

posted: 14 Feb 2010

A little over a year ago I blogged about the complete unavailability of ColdFusion books in bookstores in India (http://www.horwith.com/index.cfm/2009/1/16/namaste-coldfusion). I am writing again from my annual pilgrimage to 'Mama Hindustan' and thought I'd follow-up and see how the market has changed. I believe that the availablity of books about a particular programming language is a reasonably good reflection of the popularity and job market in a region, though I don't know of any real data that backs-up that claim.

One year later, the number of book stores in Delhi is about the same, but there are a greater number of much larger book stores (similar to Borders and Barnes and Noble in the U.S.) and the size of the 'computer' section in these book stores is much larger than last year. A few of them are comparable in size to the computer section in a large bookstore in the U.S. That said, I could not find a single copy of any book about ColdFusion. I found this a little surprising for three reasons:

  1. I'm under the impression that there's a decent job market for CF developers in India.
  2. These computer sections didn't only carry books about very common technologies - I found books about pretty much every language, theory, and computer-related topic I could think of - including very obscure and outdated technologies.
  3. One large bookstore even had an entire 'Adobe' subcategory (made up of 6 large shelves of books) in their computer section
Whether or not CF has a job market here, it is clearly much less popular than in the other countries I've visited. If I had to generalize about what technologies are the most popular (and most available) in book stores, it would be (in order):
  1. Java
  2. .NET
  3. PHP
  4. Flash/ActionScript
I'm sure most people, like myself, don't find this very surprising. Also worth noting is that the most significant difference between the computer book inventory this year vs. last year - hands-down there is a significant increase in and dominance of PHP books. One other thing I noticed, which did surprise me a little, was that there are far more Oracle books than SQL Server books on the shelves... I'm not sure why, but I expected the opposite.

Can ColdFusion Handle Enterprise Applications?

posted: 07 Jan 2010

There are a few common reasons given whenever a company says they don't want to use ColdFusion or a developer says "Oh, ColdFusion isn't a REAL programming language". One of these claims is that ColdFusion can't handle large scale enterprise applications. The majority of ColdFusion developers, especially the fanboys, immediately take offense and dive into a passionate discourse on the merits of ColdFusion, blah, blah, blah. I've done my fare share of CF-Evangelism over the years, and I do still believe that the merits of the platform make it a great solution a lot of the time... but I'm much more technology-agnostic these days than I was in my youth, and as I fall in love with other languages because of their merits, I find myself reflecting and sometimes re-evaluating my feelings about ColdFusion. In this entry I'd like to share my thoughts about CF: the good and bad, some advice for developers and companies, and some stories about recent real-world experiences I've had.

The Good
There are some things that make ColdFusion a terrific platform. Deployment is a breeze compared to most other programming languages. CFML is not a perfect language, but it is a simple language that makes most programming tasks easy to tackle. This tends to make rapid development easier to accomplish and lends itself particularly well to iterative, agile development practices and all that comes with it (like refactoring). This, coupled with the server error reporting and a few programming language constructs, also means that debugging ColdFusion applications is relatively painless and quick compared to other languages. Speaking directly to the questions of performance and scalability, it is possible to write applications that perform very well and scale exceptionally well with ColdFusion. For example, we (at Nylon Technology) recently successfully developed and deployed a large scale content management system across multiple servers and server instances. This CMS manages gigabytes of content (tens of thousands of pages) and has a lot of remarkable features (workflows, a robust permissions based security API, etc.).

The Bad
There are a few negatives about ColdFusion that should not be ignored. ColdFusion and CFML's ease of use means that you don't have to be a rocket scientist to use it. As I said, this is a strength, but it is also a weakness. There are far too many poorly developed CF applications "in the wild" and far too many "ColdFusion Developers" aren't good "Software Developers". I'm not saying all developers should have a degree in computer science, but more CF Developers should have a better understanding of the ramifications of the code they write, the limitations of the environment they're writing software in, and how to design ("architect") and develop applications that are not just modular, but easy to read, maintain, and extend. Sub-par programmers and poorly written applications will give any programming language a bad reputation. Coupled with the relatively small pool of available talent, it's no wonder some companies want to shy away from ColdFusion, is it?
So let's assume that good developers do create a well-written Enterprise ColdFusion application and have tweaked the hardware and JVM so that they know those won't factor-in as negatives - will it scale and perform well? The three second answer is "maybe... it might and it might not".
The Adobe ColdFusion Application Server is a commercial product and, as such, is a "black box". You write your code and save it somewhere that CF can see, and it "does it's magic" and spits out the results. If you don't like the results, you can change your code and try again, but you can't change what's inside that black box (i.e. the server internals). The most you can do is optimize the Application Server (CF and J2EE) and runtime (JVM) but not the way the server actually works with your code. This is obviously a problem if it turns out that some built-in ColdFusion function or tag is what's killing performance.
Though our client is happy with the CMS I mentioned earlier, along the way we did encounter several (performance related) stumbling blocks that were not the fault of the hardware or software architecture, but ColdFusion itself. One of the things that the CMS does is work with Objects (CFCs) a lot - and constructing/populating thousands of objects comes at a price. The CMS has a caching architecture that in simple terms boils down to storing CFC instances in a structure, using the ID of the content as the key name. We found that as the number of objects in memory grew, performance crept to a complete stand still - the server eventually died, as more and more threads timed out waiting for the threads that were accessing the structure keys to complete their job. Turns out that not caching the instances was the fix - but why? Because of a bug in ColdFusion that as far as I know, was first reported by David Sheldon on his blog at http://cfdumped.blogspot.com/2006/09/bad-hash-function-causes-problems-with.html. Maybe this bug doesn't affect the majority of applications, but for applications that need to store a large number of values in a complex data type, structures are not an option. One of the few fundamental data types in CF is broken - that's a big deal. I believe this issue was addressed in a CFMX 8.01 hotfix this year, but I haven't confirmed... and I personally think it's unacceptable for that bug to be made public knowledge and not be fixed for 2+ years.
We recently had another performance related issue with the application. The unique IDs of search results from a SQL statement are stored in a string and that string of IDs persisted and used for pagination. This is necessary because re-running the query isn't an option and storing the entire recordset would use far too much memory. So, the approach is right... but performance is abysmal (to the point that internal server errors are thrown) when lists get large - sometimes they're as large as 150,000+ (remember, this is an enterprise application and we need to work with huge volumes of data). The code that kept crashing looked something like this:
for(j = 1;j lte listLen(daList);j++){ test = listGetAt(daList,j); } OK, so you're thinking, "Remove the listLen() call from the loop condition" - right? We did, and it got a little better but would still time out sometimes and would be very slow other times. That code looks like:
tmpVal2 = listLen(daList); for(j = 1;j lte tmpval2;j++){ test = listGetAt(daList,j); } Turns out that listGetAt() is just a horribly inefficient beast. Temporarily replacing the list with an array and then accessing indeces in the array worked like a charm and made an exponential difference to performance:
tmpVal3 = listToArray(daList); tmpVal2 = arrayLen(tmpVal3); for(j = 1;j lte tmpval2;j++){ test = tmpVal3[j]; }
The example of listLen() brings up a good question - is there something wrong with that code or is it fair to say that ColdFusion is to blame? Rather than answering directly, I'll describe how I view the roles and responsibilities of CFML and the (ColdFusion) server, as well as my own complaints/disappointments with each. We'll start with the language - CFML. The CFML programming language is not the problem - in fact I think it's a good language (note that by "CFML" I mean "CFML and CFSCRIPT"). When I first heard about the CFML advisory panel, though skeptical, I did think it was a good idea - I still do. However, what I believe we truly need is a real language specification - one that states how the built-in tags and functions are to be implemented. Of course, since Adobe owns the server, though they've put together an advisory board, they have not published the language as a public specification. I would be pleasantly surprised if they did. There are several good examples of how a language specification is implemented and of the benefits that come from a public spec. One example is ANSI SQL - if a vendor says they support it, you are assured that your SQL will work. Another good example is ANSI Common LISP - the specification states exactly what (and in many cases how) vendors must implement the language. If you write your applications in Common LISP, you know exactly what to expect from implementation to implementation. Unlike CFML, for which a public specification could easily be made, the ColdFusion Server is a product owned by an entity and it wouldn't be fair (or make sense) to publish a standard defining how to write the server. Perhaps there is a solution, though. At a high level, the server is responsible for serving two primary functions: it is a compiler and it is a runtime platform. Perhaps it does not make sense to have an open standard that states how the runtime must work internally (beyond a specification for the side effects and behavior of the CFML language constructs), but a specification for how the server works as a compiler, if expressed at the language construct level and as part of a CFML specification, is plausible. For example, in my first list code snippet I pointed out that the listLen() in the for loop condition (for(j = 1;j lte listLen(daList);j++)) was causing a serious performance problem because it's evaluating on every pass... but there's no reason that the server, when compiling that CFML, couldn't have introspected the contents of the loop and determined that it was safe to compile it as byte code that evaluates a number (instead of the actual expression) on each pass. "Compiler Optimization" is something I've learned a lot about in my continuing education and experimentation with LISP - and it's something that the Adobe Engineering team should be focused on. I'm not saying they aren't (I really don't know) - I know they do focus on making the internal server code faster (the actual tags/functions) and the compilation process faster, but I do not know if they look at ways to optimize the actual results of the compilation process (rather than the code those results executes). A language specification that defines the compiler behavior for some, if not all, of the language would be a huge benefit to all.

The bottom line is that in the Enterprise, ColdFusion absolutely can perform and scale very well - but that no matter how great the hardware, how tweaked the VM and servers, and no matter how well written and well architected the code base, a very resource intensive application may perform poorly for no reason other than what can only be nicely described as "quirks in the server".

Framework F - My New Subway Project

posted: 15 Dec 2009

A while ago I posted several common sorting and searching algorithms implemented in CFML (http://www.horwith.com/index.cfm/2009/7/10/coldFusion-searching-and-sorting-algorithms). The code, documentation, blog entry, etc. were all written over the course of a couple of months during my 45 minute commute to and from work on the New York City Subway. As a side note - it's very interesting some of the conversations people strike-up with you when you write code on the subway. Now that I finished that, you may be wondering what my next "subway project" is? I'm writing a framework.

Yes, that's right - "a framework". I'm sure people will have a few questions - the framework is still in it's early stages so I don't want to say too much. That said, I've tried to address some of the questions that people might have about the project and/or its objectives:

  • Question: Why a framework?
    • I hate to call it a framework to be honest - frameworks tend to centralize control of your application whereas what I'm working on simplifies architecture without actually telling you how to glue the pieces of your project together. That said, theoretically this code base could be used as a framework that glues an entire application together, so I decided to use the "f" word.
  • Question: What are the objectives of this framework?
    • There are a few very specific objectives of this framework. The first objective, and reason I wrote it, is to encourage and allow CF developers to take a more functional approach to programming ('functional' in the 'functional programming' sense). There are three business needs that this framework addresses - it will have a short and easy learning curve, functionality expressed with it should be easy to test, and functionality built with it should be easy to maintain. In addition, the framework must be lightweight and fast, and it must be non-obtrusive. You must be able to drop this code into any application and use it as much or as little as you want without penalty. A more technical description of the main objective is to simplify the architecture of applications by encouraging use of 'pure' (no side-effect) functions and, if desired, an OO aproach based on using objects only to represent the business domain (data). This is realized by centralized function library management and a few encouraged practices (all documented, of course).
  • Question: Why functional programming?
    • The more I play with functional languages and try to build applications in a functional way, the more I appreciate the benefits attained by doing so. I've seen many projects go south and many developers produce poor product simply because the company, tech lead, and/or developer try to do everything according to the notion that Object Oriented Programming is "the best and only way". Often times they also don't even fully understand OO, which makes matters worse. Though the framework encourages a functional approach, OOP has some good qualities and I've tried to also encourage using those qualities in order to simplify the process of designing and building applications. Before any functional purists speak out, I should state for the record that this framework only attempts to offer some of the benefits of functional programming that have been enjoyed by some developers for 50+ years... ColdFusion is an imperative language, CFML is not equipped to offer true functional features, and I cannot change the way the server works under the hood.
  • Question: Is there a feature list for the framework?
    • There are some specific technical features and tools I have, or am, implementing - this list won't change (it could grow) but I may not necessarily push it live with everything complete. The feature list, in no particular order, is:
      • Mount function libraries which can then be called as if they were defined locally
      • Mount individual functions from libraries
      • Dynamically load libraries or functions for use
      • Allow global functions to be overridden by more local (session and request level) functions
      • Allow functions to be dynamically defined (and loaded for use)
      • Ability to chain function calls and to call function chains
      • Ability to define failover method for function/chain calls
      • Simplified domain object use by using a generic DTO base class
      • Simplify library and DTO creation via a lightweight object factory
      • Simplify testing with a simple unit testing tool
  • Question: What version(s) of ColdFusion will this framework support?
    • I'm writing the framework to run on CF 8 and above. There are a few language features in CF 9 that would make a couple things easier for me or faster for you, but the trade off isn't worth it.
  • Question: What will the framework be called?
    • I don't know - names aren't my thing. It's just some code I'm throwing out there. That said, I have to call it something (internally in the code if nowhere else) so for now it's "Framework F". No, not "F" for "functional"... the idea for this framework came to me while I was riding an F Train one morning.
  • Question: What will the framework cost?
    • As with everything else I code for fun and post on my blog - this code is costs nothing. I don't know if I'll release it with any license or put it anywhere special besides a link to it here on my blog. I also don't know if I'll maintain it or add to it ever. I'm writing it for my own professional use, so as I need to modify it I will, and if I do something I think others would find useful by all means I'll post an update. Otherwise, if people use it and like it and someone wants to take "ownership" of it, or simply use and abuse it in whatever way they choose, they're welcome to. I don't like the "black box" aspect of frameworks, and I have deliberately gone out of my way to make the code base for this framework as short and simple as possible so that people can reach in and pull out its guts and play.
I don't have a date in mind yet as far as when it will be done - I'm working on several side projects for fun, reading several books, and working on "real work" for clients all at once... but I'm trying to squeeze-in time for this project whenever I can. I wrote the core several months ago and then put it down for several months, but I am going to try and get back to finishing it off soon. Sean Corfield has graciously agreed to look at it, do some testing, and provide feedback as soon as I have it ready for him - I asked Sean to do the initial review because he not only has CF Expertise and Framework experience; he also has experience/knowledge of functional programming languages and functional programming as an approach. Anyone interested in gaining early access to the code base before I'm ready to release it to the wild should email me at simon at horwith dot com or shorwith at nylontechnology dot com. As I said above, I'm writing this my my own real world use, and I have no intention of making it publicly available until I've used it enough to know that the kinks are worked out, that it's useful, and that it's documented well enough.

Flex Camp Wall Street in New York Next Week

posted: 13 Nov 2009

If you're a Flex developer in New York and don't know about it yet, there's a 2 day Flex Conference called 'Flex Camp Wall Street' (http://flexcampwallstreet.com/) on November 16 and 17 that at $49 to attend, looks like a great deal for attendees (what else can you do in New York for less than $50??)

I'll be presenting on ColdFusion/Flex integration at the conference on Monday.

Figleaf Takes Adobe Training Online

posted: 23 Oct 2009

Fig Leaf Software (http://www.figleaf.com, an award winning Adobe Training Partner, is taking their training online - they're offering free training via the web for several Adobe products. Nice job, guys!
You can register and find out more at: http://training.figleaf.com/tutorials/

My Favorite New Features in CF 9 - CFC Enhancement

posted: 16 Sep 2009

There was one set of features in CF 9 that I forgot to mention in my features review post yesterday because nobody is really talking much about them and they're not selling points, but so far they're my favorite new features - CFC constructors and the ability to import CFCs.
Importing a CFC is something a lot of developers may not see value in, especially at first. It's kind of like doing a cfinclude on the contents of a CFC. I'm not sure if I'd recommend importing one CFC from within another because it could make it difficult to debug/maintain the code, though I suppose that it is another approach to composition. I'm a huge fan of functional programming (something I'll be writing about in the very near future) and already have some uses for CFC importing in mind. It's real easy to do in CF 9: import "cfc_filepath"; Constructors are something that I personally think should have been there from the beginning, but I'm glad to see them finally available. You have to name your constructor method "init" (I believe you can also name it "initmethod") or supply an "initmethod" attribute to the cfcomponent tag. Using constructors is very easy - you just need to have to use the "new" keyword when you instantiate the component, and the constructor will be called: objFoo=new pathToMyCFC(constructorArg1,...); The documentation for both of these features for the public beta 1 release is online at http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS61C07B60-3D65-4d71-8F2A-8411D8010E60.html

Rackspace Cloud Releases New API

posted: 16 Sep 2009

We have used Rackspace (http://www.rackspace.com) for a lot of our dedicated server hosting for years without complaint. When they bought Mosso (the cloud company) we tried it out. We'd already been researching and testing other cloud services, and the pricing and fact that it's Rackspace, made the service very attractive. Unfortunately, we had a few not so great experiences with their cloud, and the lack of a robust administrative control panel left me generally feeling not-so-impressed with the service (Amazon, on the other hand, has a great control panel). Today, Rackspace announced the release of a new API for Rackspace Cloud, and I intend to take a second look. Based on the information I've read so far, it sounds pretty nice. Hopefully I won't be let down, as it'd be great to be able to consider Rackspace among the good quality cloud services available. You can check out Rackspace Cloud online at http://www.rackspacecloud.com/.

CF 9 - A Feature Review

posted: 16 Sep 2009

I've been meaning to write my thoughts about how CF needs to change in another "Open Letter to the CF Server Team" for a while now, but wanted to wait and first discuss my thoughts about the new features in CF 9, because what I'll describe in that essay, if we ever see it, is stuff for CF 10 and beyond. Now that ColdFusion 9 is in public beta (http://labs.adobe.com/technologies/coldfusion9/) I can talk about what I think of its new features. I will write my "letter" about how I'd like to see CF evolve in another blog entry in the very near future.

I'll begin by saying I have mixed feelings about this release... and warn my readers that if you're hoping for an evangelical overview about the majesty of CF 9, then I'm probably about to disappoint you. With every release there are new features that don't matter to me personally (as a developer) but will matter to my clients, new features that I don't care for at all, and new features that I really like. CF 9 is no different. What is different with CF 9 is that with this release I keep going back and forth as to whether or not I feel that that the new features are compelling enough to spend money on to upgrade from CF 8 (if you already have a free upgrade you are well-advised to use it). More than ever, I think the decision whether or not to upgrade is really going to depend on what you need your applications to do. Anyway, here is a bulleted list of some of the new features (in no particular order) and how I feel about them:

  • Integrated ORM
    • Of all the hyped features, this is the one I'm least excited about. What made ColdFusion popular in the begining is how easy it makes it to talk to databases. SQL is a very easy simple language. Put those two facts together and personally, I feel like the ORM support is just taking something that's already easy to do and adding a layer of complexity on top of it. I'm not a big fan of ORMs to begin with, as a large percentage of application performance bottlenecks can be traced to the database, and I prefer very granular control over that. I do know the benefits and scenarios where you might benefit greatly from having an ORM - I just feel like we don't need this and the engineering hours could have been spent on something more useful.
  • Virtual File System
    • This is a feature I was especially excited about originally. I still like the feature but the more I've thought about it the more I question just how often it will be useful for the average application. I do see it being very useful for use within the core codebase of frameworks, and I like that it kind of makes lexical closure more possible or, better put, better performing.
  • MS Office Support/Integration
    • This is a feature I know will be extremely popular with developers... and with myclients. I personally spend far more time on the business logic side of things (not the display side) so I'm not excited about as a programmer, but it's definitely one of the features that will make spending money for CF 9 compelling.
  • CFScript Enhancements
    • Anyone who's ever worked with me or read my code knows that I'm a CFScript maniac - and have been since the tag was introduced. That said, I'm not as crazy about the CFScript enhancements as I thought I'd be. The addition of 'throw' is a bug fix in my opinion (how can you have 'try' and 'catch' without 'throw'?) but in general I don't like what the syntax becomes when you implement many of the other CFML tags as functions in a script block. I've used CFSCRIPT exclusively for about 10 years or so, and the limitations before this release haven't been a huge issue for me and are very easy to get around. I should also mention that although I thoroughly embrace CFScript, the last thing I want to see is CF supporting a syntax that is anything more like Java than it already is. I know Java, I don't like Java, and if I ever want to write Java code, I'll use pure Java. That's not why I use CFScript and I wouldd hate to see it go that route. I know that's an exhagerated reaction to the CFScript enhancements, but more and more we see Java creeping in where once only CF roamed... and writing everything in CFScript is a part of that. This is a feature that was obviously driven by developer (not client) requests and not surprisingly, is not a reason to pay to upgrade in any event.
  • CF Services
    • A while ago I wrote (I believe in a comment on Tim Buntel's blog) about the need for ColdFusion to be able to position itself as a COTS product if it is ever going to be taken seriously for use in very large projects (I'm talking about projects that cost 100's of millions or more dollars). For mom and pop shops this feature means little (unless they're building Flex/AIR apps) but in the large enterprise, this is a very significant selling point for CF 9.
  • Flex/AIR Integration
    • The Flex/AIR integration doesn't allow you to do anything that you couldn't already achieve with a little CF code, but it will probably make life easier for a lot of (Flex and ColdFusion) developers, and I do think that good integration between ActionScript based applications and the CF Server is integral to keeping CF competitive and to ensuring ColdFusion's longevity. If you're developing business applications with Flex Builder, er... Flash Builder, this is a feature that could very well be the deciding factor in choosing to use ColdFusion 9 as your server-side technology.
  • AJAX Enhancements
    • The AJAX widgets in CF 8 are a sore point for me - they're great until you hit some limitation where you need them to do something just a little different, and then you have to write hacks to make them behave exactly how you need them to. Then, somewhere in the middle of it all you think to yourself "Why didn't I just use JQuery?". I feel like a lot of the new AJAX stuff in CF 9 should have been in CF 8... and I'm not 100% sure if it's really what I'd call 100% complete yet, but like I said earlier I'm also not a big UI Guy. I do think the Google Maps integration was a great idea and I'm sure that it'll be a big hit with developers - though again, it's not something you couldn't do before CF 9 with just a tiny bit of work.
  • Lucene Integration
    • I was glad to see Lucene integration, as Verity has performance and functional limitations, and I've always liked Lucene. It's not a feature I think anyone's going to buy CF over, but definitely a good feature.
  • Serialization Improvements
    • The ability to serialize objects is rarely used but has a place, especially in the enterprise. I'm glad they took the time to add this, but I should mention that this is really more of a bug fix - when serialization support was first introduced, everything should have been serializable. In fact, to be honest serialization of all variables should have been there from day one of CF running on Java.
  • Server Manager
    • If you never administer, install, or troubleshoot servers then this feature won't matter to you. Speaking as someone who does, this is one of the more useful things added in CF 9 and it will make life much easier for server admins everywhere. Ease and robustness of deployment, management, and monitoring is something you look for when you're thinking about deploying on the enterprise, and this application will definitely help in that arena. Aside from actualy being very useful, it makes CF look "all grown up" to certain-minded decision makers.
  • Access to local variable scope in functions
    • This is a good thing to have, by all means, though I do think it's something that should have been there from day one in CFMX (it half-feels like a bug fix). Again, it's not a feature I think anyone's going to buy CF over, but I'm definitely glad to see it.
  • Performance Improvements
    • Performance improvements in CF 8 were probably the best "feature" in my mind - it was the one reason to spend money to upgrade that almost nobody could argue with and that everyone can use. I haven't personally run any performance comparisons, but faster is always better... and always a reason to upgrade.
  • Sharepoint Integration
    • There's not much to say about this except that if you use sharepoint or have clients who uses sharepoint and you need to integrate with it, this feature is going to save you a lot of time. Like any other feature based on integrating with a 3rd party product, if you don't use that 3rd party product then it's obviously not an impressive feature for you (and vice versa). Like some other features I've mentioned, this feature may also help get CF into large enterprise environments.
  • Caching Enhancements
    • I like that less experienced developers now have an easy built in way to cache content and code. Like many other developers, I've grown so used to implementing my own caching strategies in the applications I build. I'm curious about whether or not it performs better than "home grown" caching implementations. I have a tiny fear that if I use this feature, I won't like having the same level of access to what's going on that I have when I write my own caching code, but if it performs better, it may be worth it.
  • PDF Improvements
    • This feels a lot like improvements that make up for what should have been there from the begining, but the PDF support definitely needs improving and I'm glad to see it being improved.
  • Portlet Specifications
    • Similar to sharepoint integration, if you use portals this feature is great... and this will definitely be one of those features that comes up when large organizations are evaluating software for massive scale enterprise applications.
  • Datasource Optional
    • I'm not excited about this feature at all. It was easy enough to have a variable hold the value of your datasource name - so now you change it in one place instead of another. I also worry that it makes code a little less self-documenting, especially in applications that use more than one datasource. It doesn't really save me any time or effort and isn't a reason to upgrade, but I'm sure some folks will love it.
  • 64 Bit Support for CF Standard and Enterprise
    • I don't know how many companies are running CF in a 64 bit environment now (since it was only officially supported with 8.01) nor how many that are running in a 32 bit environment are ready and willing to move to 64 bit. I can tell you that whatever either of those numbers is, they're not big enough. After several initial hiccups I've come to be quite impressed with 64 bit JVM performance and with the performance of 64 bit OS' including Windows Server. I will say that I have a feeling that some admins will install CF Standard on a 64 bit OS, set the JVM to as much memory as they can (knowing that the 64 bit JVM supports it), and then stare dumbfounded when their CF Server pegs the CPU and renders the box useless. Hopefully, Adobe will release some sound JVM configuration suggestions when deploying on a 64 bit OS. Still - if you use CF Standard then in my opinion being able to run it on a 64 bit OS is a reason to upgrade (if you're running CF 8 Enterprise, you can already move to 64 bit).
  • ColdFusion Builder (Bolt IDE)
    • I have grown accustomed to using a free IDE (CF Eclipse) for ColdFusion development and so I am naturally hesitant to say I like this shiny new IDE that Adobe is going to charge for. If CFEclipse had good introspection (most including dot operator support) and had refactoring capabilities, I honestly probably wouldn't consider this new IDE. The refactoring support in ColdFusion Builder still isn't as robust as I'd like to see, so until I see that feature fully implemented and I see the final pricing points, I'm on the fence. I know it has some other nice features, but the productivity gains I'd get from the two features I just mentioned are what would make it an easy decision for me. If Adobe decided to make it free it would be a no-brainer, as I'm sure they'll continue to add terrific new features. I'll have to remain undecided about whether it's worth the price tag (whatever that may ultimately be) for now.
So, what does all this actually mean? Nothing really - these are just my thoughts and feelings about the features. Without a doubt in my mind, there isn't a single feature in this release that I would say is the best new ColdFusion feature I've ever seen, but there are a lot of features that are definitely worthwhile. I think that the features most likely to drive companies to spend money to upgrade will be the Flex/AIR integration and the MS Office integration, but we'll all see soon enough.
If you ask me today whether or not you should spend money to upgrade when CF 9 comes out, I'd tell you to read the feature list, think about your needs and the needs of your clients, and then decide. I know that for those of you who are used to reading my editorials and reviews of CF releases in the past, this may have seemed like a negative review. To be honest, I suppose compared to some of my prior reviews it is but my intention was simply to give a 5 minute overview of each notable feature from an unbiased "on the fence" point of view. There are some great things in there and some things I could live without. As a programmer CF 9 has very little "wow factor" for me, but as an IT Manager there definitely are some compelling reasons to move to the new platform. For many of our client applications these features will be very useful and I do plan to upgrade some of our servers when CF 9 is released.

ColdFusion Searching and Sorting Algorithms

posted: 16 Sep 2009

Every now and then I find a book related to programming that I put on my mental list of 'must read frequently' books - these are the books that I revisit anywhere from every 6 months to every 2-3 years, simply to stay sharp and to refresh and re-enforce the basics. In order to make this list, a book has to to be well written and be about a topic that makes me think and in some way, shape, or form teach me something every single time I read it. One day I really should post the list here for the benefit of anyone looking for a list of the best books to read to build a solid core understanding of important concepts and techniques for software design, development, and management. Today is not that day. Among this list of books is the Wrox Press "Beginning Algorithms" book (http://www.amazon.com/Beginning-Algorithms-Wrox-Guides/dp/0764596748/ref=sr_1_9?ie=UTF8&s=books&qid=1247243101&sr=1-9), which I recently re-read for the um-teenth time.

I used to (back in 2003-2005) post code on this blog very frequently - primarily APIs, implementations of design patterns, and mini-frameworks and sample applications illustrating programming techniques (AOP, OOP, etc.). It's been a while since I've encountered a subject are, technique, or concept that I felt was worth illustrating in code or hasn't already been illustrated in code by someone else... until I picked up that algorithms book for the first time in quite a while. While I read over it again I realized that nowhere that I know of has anyone provided a comprehensive overview/sample of sorting algorithms using CFML. I find that especially surprising given all of the dialogue and emphasis on taking an Object Oriented Programming approach to CF development within the devolpment community. So, I spent many of my New York City subway rides over the past month implementing sorting algorithms in CFML. The result of wihich I'm finally able to share.

I've created implementations of 6 major sorting algorithms in CFML:

  • Bubble Sort Algorithm
  • Insertion Sort Algorithm
  • Merge Sort Algorithm
  • Quick Sort Algorithm
  • Selection Sort Algorithm
  • Shell Sort Algorithm
I've also implemented the Binary Search algorithm (for searching for an object within a sorted array of objects) and the Binary Insert algorithm (for inserting an object directly into its sorted position in a sorted array of objects). In addition to implementing the sorting algorithms, I created a sample of sorting object without algorithms using Query of Queries. Each algorithm is implemented as a CFC, and should work as-is if you drop them into an application. The only code you have to write in order to implement them, is to write a comparitor function (or several if you want to be able to sort on various properties). The comparitor functions always accept 2 arguments and simply return 0 if the two items to compare are the same, 1 if the first argument is greater, or -1 if the second argument is greater. All of the algorithms accept an array of objects (technically you could also pass arrays of other data types if your comparitor functions expect them), and all of them return a sorted array. All of the algorithms support sorting in ascending and descending directions. Sorting objects that are already in memory is often times more efficient than recreating them, and these algorithms will certainly be more efficient than trying to loop/compare using some other linear 'brute force' type of approach.

I'm not going to describe the algorithms themselves here, nor am I going to get into detail about the efficiency of each compared to the others. The sample application times the sorting, inserting, and searching for you and tells you how long each took. The sample application includes an 'about' page in which I describe how each algorithm conceptually works, and I also give some suggestions about their use including recommendations about which algorithms tend to work best in certain scenarios.

You can download all of the code at http://www.horwith.com/downloads/search-sort.zip. I look forward to hearing how people put them to use as well as any other findings with them.

Accessing Cluster Instances That Are Hidden Behind

posted: 16 Sep 2009

Whenever I install ColdFusion Enterprise Edition, I install with the built-in web server - then I use wsconfig to connect my web server(s) to my CF instance(s). I then block traffic on those internal web server ports to the outside world. I set up CF this way because it:

  1. Makes it easy to make the CF Admin available without having to expose it to the public
  2. Removes complications that can arise when you need to use RDS, the server monitor, etc
  3. Allows me to access specific instances when I need to when I'm remoted into the machine
I recently had an interesting issue arise. In an environment I set-up (as described above) a client application was running off of a J2EE cluster of 4 instances. The application caches a lot of data in memory, and when certain events occur in the administrative application, those objects in memory need to be refreshed.
The first problem this poses is that from the instance that the user is currently logged in to, code needs to be executed on the other 3 instances so that they also refresh their memory cache. That's simple enough to achieve - just create a page or webservice that any one server can call on the others. You need to know what instance you're on so you know what the other 3 instances are, which also isn't very difficult (see a post of mine from a while ago at http://www.horwith.com/index.cfm?mode=entry&entry=80134845-E081-0478-475B6D83D8FAF903).
Unfortunately, the application itself is only accessible via very specific domain names... so I can't just send an HTTP or SOAP request to "127.0.0.1:830x" - all requests to this application must run through "www.x.com", which poses a problem when you need to access each instance specifically. A relatively simple solution is to send your HTTP request to the page/service via the domain name with a JSESSIONID cookie that you know belongs to the server instance you want to run the request. To get a valid session value for any one instance, I created a cfm file beneath the internal JRun web server on each instance, that just returns the session id. That file looks like:
#session.sessionID# From the admin I request that file using cfhttp to get the value of the session in #cfhttp.filecontent#. Then I make my HTTP or SOAP requests - each time passing a cookie named JSESSIONID with the value I got when I asked the internal web server on thatinstance for a token value. One thing to note - you must pass the value as a cookie - passing it as a url value only works if cookies are disabled (i.e. if the cookie is there, the url variable is ignored).

British Government Finally Apologizes For Unfair T

posted: 16 Sep 2009

Yesterday, the British Government issued a formal apology for its terrible acts against Alan Turing (http://www.number10.gov.uk/Page20571). Mr. Turing was a brilliant mathematician, who we owe so much to for his work in the fields of encryption, computation theory and lambda calculus, artificial intelligence, and computer science. Specifically, he played a very important part in developing the stored program machines that would evolve into the modern day computer, in breaking Nazi enigma machine cryptology (using his own 'Turing Machine'), and in laying down much of the foundation of Artificial Intelligence theory. Turing also studied under Alonzo Church and contributed significantly to the development of lambda calculus and other computation and algorithm theories... from which, modern day functional programming was born.

I've studied his work a fair amount and have long felt that he was one of the 5 most brilliant minds of the past 200 years. The cruelty inflicted on him by his own government was tragic and it is good to see a formal apology for the way that this hero was so wrongly treated.

CF 8.01 Cumulative Hotfix 3 JVM Compatibility Prob

posted: 16 Sep 2009

One of our staging environments is running CF 8 multi-server and has instances running CF 8.01 and instances running CF 7 - all running on 32 bit Windows Server 2003. If you look at the system reqs for ColdFusion (http://www.adobe.com/products/coldfusion/systemreqs/#coldfusion) on 32 bit windows, JDK 1.4.2_14, 1.5_13, and 1.6_04 are supported. If you want to run all instances on one JDK, using JDK 1.4.2_14 makes the most sense, as CF 7 does not support JDK 1.5 or 1.6.

After applying CF 8.01 Cumulative Hotfix 3 (http://kb2.adobe.com/cps/511/cpsid_51180.html) to a CF 8.01 server instance, the instance appears to start, but any requests for CF pages that you make result in a 500 error with the following description: "coldfusion.server.ServiceFactory$ServiceNotAvailableException: The Security service is not available.". Switching to the JVM that installs by default with CF 8 makes the error go away.

Unfortunately, the hotfix tech note does not currently mention that it breaks the CF 8 compatibility with JDK 1.4.2_14 and the system reqs doc still states that CF 8 supports this JDK. The CF 8.01 cumulative hotfix 2 did not break this JDK compatibility. My advice to anyone thinking of upgrading to CF 8.01 Cumulative HF 3 is to first confirm that the server instance(s) you plan to update are at least running on JDK 1.5_x or above.

Is Augmented Reality Useful For Anything?

posted: 16 Sep 2009

Like so many other people, though I love seeing the creative ways in which people push technology to its limits, I often find myself thinking "that's cool. Useless... but cool". This was my initial reaction to augmented reality - it's very slick and it's fun to play with, but I don't find twisting a piece of paper around in front of my webcam all that interesting or useful after 2 or 3 minutes. Then I saw the light.

I just watched a demo of how augmented reality created using a mobile phone camera, GPS, and accelerometer (iPhone) can be combined with information from the internet to create... well, extremely useful augmented reality applications. Maybe everybody already got it and my lightbulb was just slow to go off on this one. Whether or not that's the case, I'm glad it did.

Take a look at this demo of an augmented reality application created by British iPhone development company Acrossair:
http://news.bbc.co.uk/2/hi/technology/8193951.stm

Is Adobe the Next Microsoft?

posted: 16 Sep 2009

Adobe could be the next Microsoft... and that's not necessarily a compliment. Today, ZDNet News published an article titled "Is Adobe the next (pre-2002) Microsoft?" in which they compare the rising number of security holes being found and exploited in Adobe Flash Player and Adobe Acrobat Reader with the problem Microsoft had with vulnerabilities being exploited in their products years ago. It was so bad that among many circles, suggesting Microsoft products as a solution to whatever requirements you needed to meet was grounds for public humiliation. Their products were known targets and it was understood by many that using certain MS software was risky. No software is really 100% safe, but Microsoft took it seriously and became very proactive about addressing the (technical and image) issue both internally before software is released and publicly when a vulnerability is found. The article does give Adobe credit for being proactive and doing a reasonable job addressing vulnerabilities when they're found, but doesn't hide an opinion that Adobe still has a way to go.

The ZDNet article is online at http://news.zdnet.com/2100-9595_22-329118.html

A Bit of Advice When Running CF 8 on 64 Bit

posted: 16 Sep 2009

By now everyone has probably heard that the optimal JVM and J2EE Application Server settings in any given environment depends primarily on six factors:

  • What OS you're running on
  • What hardware you're running on
  • What application software (CF and J2EE Server) you're running
  • What JDK version you're running your server instance(s) on
  • What the typical traffic for your web application(s) looks like
  • What those web application(s) do

It's true - there's no silver bullet for optimizing a CF/J2EE installation - it is very dependent on all of the variables I listed above, among other factors. That said, I've recently optimized and deployed several applications on the 64 bit version of CF 8.0.1 Enterprise running on top of Windows Server 2003 (64 bit, of course) and have come to two useful conclusions that appear (so far) to be consistent and worth keeping in mind if you ever move, or consider moving, to a 64 bit platform with CF:
  1. If you want to take advantage of what a 64 bit environment can do, have at least two physical CPUs. Though you might think that doubling the CPUs from one to two would cut the average execution time in half, in my experience it generally improves (that is, "decreases") execution time by 75% just by adding a second CPU to a single CPU machine running a 64 bit OS (cores don't appear to make anywhere near as much impact - I'm talking physical CPUs here).
  2. Running several instances with smaller (3 Megs or less) memory stacks tends to perform better than one instance with a big memory heap

Though my testing results have been consistent, please remember the rule about the six variables that determine an optimal configuration... the bottom line is that there's never any guarantee about what works best in a specific environment - only what's proven to work and what's proven not to work.

If you're Having Problems with ColdFusion 8.0.1 -

posted: 16 Sep 2009

I just wanted to point out that if you're running CF 8.01 and go to the ColdFusion support page (http://www.adobe.com/support/coldfusion/) to get the latest cumulative hotfix, it shows a link to ColdFusion 8.0.1 cumulative hot fix 1 (http://www.adobe.com/go/kb403622) but it should show a link to the more recent ColdFusion 8.0.1 cumulative hot fix 2 (http://kb2.adobe.com/cps/403/kb403781.html). Anyone not aware that hotfix 2 was released could end up installing the older hotfix and go on their merry way, not realizing their server is not actually up to date with the latest patches.

I've made Adobe aware of this and I'm sure it will be corrected in the immediate future.

Advice For Working Around Getting An Error When Cr

posted: 16 Sep 2009

Ever get an error at the bottom of the page when you try to create an instance (ColdFusion Enterprise, Multi-Server or J2EE configuration) on Windows via the CF Admin that looks something like this?

There was a problem
Message: The specified Directory attribute \servers\cfusion\SERVER-INF\temp\cfusion-war-tmp\{some-UUID}\cfusion.ear\cfusion.war\CFIDE\scripts cannot be deleted.
Detail: You may not have permissions to delete this directory. The exception occurred during a cfdirectory action="delete".

I recently did, and after several minutes of Googling, still didn't find the answer. I also tried several different file system permissions settings at the Windows OS level and got inconsistent results. The one thing that did seem to work fairly consistently is to grant full privileges to the "CREATOR OWNER" user account (as well as whatever account you have the CF Service running under) to the "servers" directory and all its children. Among other things, I initially tried this same tactic on the "{path-to-cfusion-instance}/SERVER-INF/temp/cfusion-war-tmp" directory in which the error occurs but surprisingly found that it works some, but not all, of the time.
On a side note, if you get this error I also recommend turning off Windows Firewall and any other firewall/anti-virus software that might be running, while you're trying to create the instance(s).

Recent Interviews and Advice from Shantanu Narayen

posted: 16 Sep 2009

I read two interesting interviews this weekend that I thought I'd mention. The first was an interview with Jeremy Allaire in which he offered his thoughts on the current and future value of online media. That interview is online at http://brainstormtech.blogs.fortune.cnn.com/2009/07/16/had-i-been-at-sun-valley/ - Jeremy's a smart guy and generally always has something insightful to say.

The New York Times ran an interview with Shantanu Narayen, CEO and President of Adobe, this weekend. It was interesting to read what he had to say about management and productivity. I particularly liked this quote from the interview:
If I can complement people?s strengths by surrounding them with people who can complement their areas of weakness, that?s probably a better recipe for success than trying to say, "O.K., you need to change."
The Shantanu Narayen interview is online at http://www.nytimes.com/2009/07/19/business/19corner.html?_r=1&scp=1&sq=Adobe%20CEO&st=cse.

ColdFusion Admin Datasource Page Glitch in CF 8

posted: 16 Sep 2009

Just experienced this and didn't find anything via Google that described the exact same thing so I thought I'd blog it.
If you leave a browser window open to a CFAdmin datasource details pagelong enough to time out and then click a link, it prompts you to log-in again. When you log in again, you're on the same page you were on before in the admin (the details for the datasource) but the datasource name has now been replaced with "foo?targeted=true" where "foo" is what the actual datasource name is. I'd expect you'd get an error if you actually submitted the page... or you'd rename the datasource, which would cause errors in any applications that use it.

Another Open Letter To The CF Server Team

posted: 16 Sep 2009

Nearly three years ago, I wrote an "open letter to the CF server team" in which I listed and briefly described many features that I'd like to see implemented in the server (http://www.horwith.com/index.cfm?mode=entry&entry=9C5F8D69-E081-0478-47FF6F46263B7F5D). The public beta of CF 9 means that in all likelihood they're in the early stages of planning/programming CF 10, so I thought it was high-time I send another letter and share what my wishlist for ColdFusion looks like these days.

Dear CF Server Team,
It's been a while since I last wrote you, I trust you are doing well? It's been a while since I last sent you a list of requests/suggestions, so I thought I'd reach out and give you a few ideas to implement, debate, and/or laugh about amongst yourselves. In no particular order, they are:

  1. Add J2EE Server Tuning Features
  2. Add Source Control Integration
  3. Give Us More Compiler Control
  4. Improve the Datasource Pool
  5. Give Us Lexical Closure
  6. Add Diff and Merge Functionality
  7. Add Method Overloading
  8. Give Us Modular Deployment (aka "features a'la cart)
  9. Offer Cloud Support
  10. Give Us the Ability to Override/Extend Core CFML Constructs
  11. Improve the Exception Handling Framework
  12. Add an Internal Mail Server
  13. Add Social Networking Support
  14. Expose the Cluster
  15. Improve Performance
  16. Add Content Management Support
  17. Do Not Simply Imitate/Expose Java
  18. Give Us AJAX Framework Flexibility
  19. Let Us Treat Data As Code
  20. Add Support for Regex Lookbehinds
  21. Enhance CFC Functionality

Some Explanations:

Regarding #1
Optimizing the JVM (primarily jrun.xml and jvm.config) makes a massive impact on performance, and the optimal settings varies based on what version of the JVM you are running, what version of CF you are running, how your application(s) are coded, and what hardware and OS you're running on. Unfortunately, only a handful of CF developers know how to tweak these settings. It would be extremely useful if there was a screen in the admin that tries to suggest (and implement) optimal changes to these settings based on current performance and available resources.
Regarding #2
Integration with source control systems so that in the admin you could point an application at a repository and deploy or automate deployments, as well as interact programmatically with the repository from code, would be nice. I'd imagine it'd be relatively straightforward to add an SVN Event Gateway, if nothing else.
Regarding #3
I'd like to see administrators/developers have more control over how code is compiled/executed. CF 8 introduced a checkbox in the admin for turning off type checking for function arguments - I'd like to see more, similar, checkboxes. For example, it'd be nice to be able to turn off case insensitivity, turn off type checking all together, or turn off searching through the scopes for variables that aren't prefixed.
Regarding #4
My understanding is that each datasource defined in the CFAdmin results in one connection in the pool, which is shared by all queries/stored procedure calls that use that datasource. The ability to specify that 'x' number of connections should be in the pool for a single datasource name could drastically improve performance in many applications.
Regarding #5
Currently, we can declare a variable local to a page/CFC, local to a tag, and local to a function. I'd like to be able to declare variables that are local to loops and other constructs. These variable references would have to cascade, so if I have a 'for' loop with an 'i' counter, and in that I have a 'for' loop with a counter 'i', the proper i reference is referenced in the proper location. It would also mean that a loop that references a variable 'foo', which is undefined in that loop, would look first for a 'foo' variable defined in its enclosing loop, which would do the same in turn, and so on until the server is looking at the variables scope of the caller code. I'd also like for the "Compiler Control" feature to include a checkbox in the admin by which I could enforce lexical closure - i.e. restrict access to any shared scopes outside the current available scope (for example - inside a function you cannot access the server, application, session, form, etc. scopes). I'd imagine code compiled this way would perform better, and it would make testing infinitely easier and more reliable.
Regarding #6
The addition of functions to perform a diff or a merge on the contents of arrays and structures would be very useful. The only thing we currently have that's close to this is the ability to structAppend() keys into a structure that doesn't have them (or that are already there if you're willing to overwrite) from another structure.
Regarding #7
Method overloading, i.e. the ability to declare multiple functions with the same name but different argument signatures, would add an enormous amount of flexibility to how ColdFusion applications are built. Among the benefits developers might gain are a more robust form of polymorphism, multiple inheritance, and the ability to break away from the "message passing" paradigm of Object Orientation in favor of a more functional approach to OO - similar to how CLOS implements objects. It would also be fundamental for implementing my suggestion for an "Improved Exception Handling Framework" (see # 11 below).
Regarding #8
I know this is something that marketing/sales would weigh-in on heavily, but rather than having one version of CF at one price that just "includes all" and one version that either limits or disables certain functionality, I'd prefer to see CF support a paradigm by which you pay for and install only the modules you want. If nothing else, the ability to simply turn on and off modules in the admin would be useful. After all, if I have an application that, for instance, doesn't use charting, why should I pay for the performance price of loading the graphing and charting components when my server starts?
Regarding #9
I'd like to see a realistically priced licensing model for running CF in a cloud. My personal feeling is that running CF in a cloud right now really does little more than allow you to do fail-over (which you can already do with load balancers and/or J2EE clustering) and some fancy server hardware upgrading on demand. Ideally, supporting clouds would at some point be complemented by programmatic functionality that allows developers to MULTI-PROCESS page execution to take advantage of the cloud.
Regarding #10
If I want to modify, extend, or override the default behavior of a tag or function that's built-in to ColdFusion, why shouldn't I be able to? I'd like to see the core language (tags/functions) exposed in a namespace that we can access. If, when the server compiled your CFML, it looked first for a function or tag in a local or application namespace, THEN if it's not found looked for the function or tag in it's internal namespace (the one containing the core language that ships), much like the way it searches through scopes to find a variable when you haven't prefixed it, developers could override and extend the built-in language constructs. This would not only make the language much more useful for developers, but would allow Adobe to let the community help define new and improve existing CFML language constructs.
Regarding #11
The current "try-catch-throw" methodology has some limitations, as do all languages that handle exceptions this way. I'd prefer to see exception handling work more like "conditions" in LISP. It goes something like this: Developers would write functions that handle errors and register them in some way with the server (or just have them available in the current request, I suppose). When developers want to programmatically raise an exception, they would simply throw a CFC instance they've created (the instance would either extend a CF Error object or implement its interface. When an exception occurs (or is raised/thrown programmatically), CF looks for the function who's arguments most closely match the arguments generated by the error. CFML would have some functions that allow the developer not only to re-throw the exception or end handling their, but also to return to the code that was executing when the exception occurred, or immediately after or before where the exception occurred.
Regarding #12
I'm not suggesting that the team implement a full-featured mail server, just a very lightweight outbound-only mail server that maybe has just a few configuration options (like 'from address' and 'port'). So often, developers use CFMAIL to send themselves error emails. This currently isn't an option when there's no mail server available, and often times it is less than ideal to use a mail server that's also being used in production for these 'debugging emails'. A CFINTERNALMAIL tag that only uses the lightweight internal mail server would be great.
Regarding #13
Of all the items on my wish list, I'm least enthusiastic about this one. That said, clients are asking for social networking more and more frequently - whether in the form of integration with sites like facebook or twitter, or by way of some other community building functionality on their site. I haven't put a ton of thought into what this feature would look like (though I know it would have to include data push to AJAX) but I know that requests for social networking functionality are only going to rise, and anything that makes that quicker/easier to do would be great.
Regarding #14
Though there are workarounds for much of this, I'd like to see information about the cluster (if CF is a member of one) and about the J2EE instance CF is running on exposed via some CF functions or built-in variables. Railo added a 'cluster scope' to their server - when I heard about that I thought, "now there's a great idea - I wonder why nobody on the ColdFusion engineering team thought of that yet?"
Regarding #15
Performance is getting better and better with every release it seems, but there's always room for improvement, and improving performance is always a feature I'd like to see in a release.
Regarding #16
So many companies want some level of content management functionality for their intranet/internet applications. I'm not suggestion that the engineering team necessarily implement a completely feature rich CMS inside of CF, but some simple content management functionality would definitely make life easier for a lot of developers and would save a lot of companies money (either by reducing programming hours or avoiding purchasing a commercial product). I wrote a little about this not too long ago (http://www.horwith.com/index.cfm/2008/6/28/would-adobe-integrate-a-CMS-into-ColdFusion)
Regarding #17
This isn't so much a feature request as it is a word of caution/advice. I understand that CF was moved onto a Java platform nearly 10 years ago largely so that the engineering team could take advantage of the vast amount of Open Source code that is available, and I realize that it is also tempting (because it is so quick and easy) to simply drop an Open Source project into the server and expose it with a tag. If there is something CF doesn't do out of the box, and there's an Open Source Java project that does what I need, it's usually not much work to integrate the project into my server library and figure out how to use it myself. For example, whenever I needed image manipulation functionality in CF I always just dropped the Jakarta tag lib on the server and away I went (http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/intro.html). I'm not saying it's not easier now, but it wasn't difficult before, and I rarely had to do it on a project so I'd rather not have the server load those libraries if I'm not going to use them. Also, one benefit of using Open Source libraries directly is that when I can't get them to do what I want, or an error is occurring, I have many more options for troubleshooting and fixing the problem. When it's built-in to the server and it doesn't work the way I want, my hands are tied by the "black box" that is the commercial product, which in the end usually results in wasted hours.
Regarding #18
I think developers would benefit from having more control over what JS libraries are used (and how they are used). Being able to tell CF you want it to use JQuery, or YUI, or 'JS Framework XYZ' would be great.
Regarding #19
The ability to treat data as code and code as data is something I would love to see in CF, though of all the features listed here, I would be most surprised to see implemented. The 'evaluate' function supports similar but limited functionality. I'd like to take any string and be able to treat it like code, with an escape character to delay evaluation. This would be particularly useful in that it would allow developers to work with anonymous functions and would allow code to write code. I realize that the latter use case can be achieved by using the CF 9 Virtual File System, but the feature I'm describing would eliminate the I/O aspect that's present with virtual files all together.
Regarding #20
This one isn't a big deal until you need it, but I can't think of any reason why regular expression lookbehind support has never been implemented, and I wouldn't think that it'd be very difficult to implement.
Regarding #21
The support for CFC constructors and for importing CFCs that were added in CF 9 were big improvements. I think the OO implementation would be rounded-off well if we had support for implicit getters and setters, as well as support for a deconstructor method.

In Closing
I realize that the AJAX framework flexibility, social networking, cloud support, and CMS integration features are the only things on the list that directly help sell servers, whereas the rest are primarily for the benefit of developers. However, performance is also a selling point and is certainly necessary to keep repeat business, and many of these features aid in performance. Aside from my own reasons for wanting them, the remaining features, if nothing else, should make the server more attractive to "seasoned developers", would allow developers to do things they wouldn't think of doing now, and would help argue the case that ColdFusion is a mature (or "serious") language.

Namaste, ColdFusion

posted: 16 Jan 2009

In conversational Hindi, 'namaste' generally means 'hello' but can also be used to say 'goodbye'. On my annual pilgrimage to India this year, I came thinking that it would have the former meaning in the sentence 'Namaste, ColdFusion' but am sad to say that the latter holds more true. Put simply, Adobe appears to have lost the server-side programming language popularity contest in India.

Before coming I noticed a small rise in the number of emails I receive from companies in India offering outsourcing of CF development. This led me to believe that perhaps Adobe was successfully marketing the product in the Indian sub-continent. Though I can't really say they aren't doing so, my observations upon arrival tell a very different story. I visited 8 different large bookstores in New Delhi - the same bookstores that I visit every year on my trip. This year, for the first time, 7 of the 8 bookstores didn't have a single book about ColdFusion. It'd be nice to think that this is because the CF books are flying off the shelf, but that's not the case. Yes, I did inquire about this just to make sure, and the story was the same each time: CF books aren't in demand and the stores have no intention of carrying them. Every store had a decent selection of books on AJAX, Javascript, Java, PHP, and .NET of course - with PHP and .NET appearing to be the two platforms with the best presence.

It was no surprise that there were books on Flash, given it's popularity. What I was pleasantly surprised to find however, was the popularity of books on Flex and ActionScript. I haven't seen many emails from companies offering Flex outsourcing yet, but don't be surprised if we see an increase in Flex outsourcing resources in the near future.

In addition to perusing bookstores, I did talk with some relatives and friends who are in IT in Delhi, and my observations do seem to be on par with reality. I should give a disclaimer that these are merely observations I made on my visit: feel free to take them with a grain of salt or to make whatever assumptions you want from them.

Thanksgiving and Terror

posted: 27 Nov 2008

Quite an exciting day today. Since moving to New York I have been fortunate enough to take my son to the house that Babe built before it closed and spend a lot of time with him at Coney Island this past summer - Coney Island's last season. Now, today, I took my son to his first Macy's Thanksgiving Day parade which, of course, he loved.

Despite the wonderful experience of watching my son's face light up at every site and sound of the parade, it's also been a somber day. I've spent the bulk of the past 24 hours following what's happening in Mumbai and talking with relatives there.

This Thanksgiving I can be very thankful that all of my family there are safe. I just wanted to post something on my blog about the terror attack there in the hope that people here in the States will keep the good people of India in their thoughts and prayers today.

No MAX for me this year

posted: 14 Nov 2008

For the first time since 1999 I've decided not to attend the big annual conference (I've been to every MAX and Allaire/Macromedia DevCon to date). This is partially because I feel as though there is little resemblance to DevCon left, partially because I feel as though the number of sessions being offered that would be useful to me doesn't justify the cost or time out of office, and because I'm just too busy. If I had attended it would have primarily been for the business development opportunities.

I am sending an employee and have no doubt he'll get a lot from the conference. A lot of old friends emailed to ask me if I am going so I thought I'd just let everyone know.

Google Custom Search Looks Pretty Slick

posted: 21 Oct 2008

I think the subject says it all. If you haven't checked out custom searches yet, I definitely recommend taking a look: http://www.google.com/coop/cse/

FigLeaf Software Releases CF 8 Admin Course

posted: 09 Oct 2008

Figleaf Software (http://www.figleaf.com, the premier Adobe Training Partner (and, I'm proud to say, a former "professional home" of mine) has just released a 3 day hands-on class on administering CF8 servers. Class information is on their training site at http://training.figleaf.com/Courses/Administering_ColdFusion.cfm.

My friends at Figleaf have an impeccable reputation as a solutions and training company and I don't doubt that this class is the premier resource available to anyone interested in becoming a proficient CF Server Administrator.

PHP Driven Flex Applications Finally Becomes a Rea

posted: 16 Sep 2008

Zend just announced that they're collaborating with Adobe to make PHP-driven Flex applications easier to build. The major component to this is the addition of AMF support to PHP. Though I've been a long time and well known ColdFusion evangelist, I have been spending a lot of my time lately playing with and learning PHP... and I like it. A LOT.

It's also a solution I find myself recommending clients more and more these days. I'll discuss those reasons in another post, as I don't want to sidetrack from the big news. I'm very happy to see Adobe making PHP powered Flex applications an attractive and legitimate option for companies, and I'm really looking forward to see the applications that result as well as the impact this has on the adoption of Flex by organizations.

The Zend press release is online at http://www.zend.com/en/company/news/Press/zend-to-collaborate-with-adobe.

ColdFusion Evangelism Kit

posted: 16 Sep 2008

Kristen Schofield, Senior Product Marketing Manager at Adobe, has created a ColdFusion Evangelism Kit! For more information, see her blog post at http://www.webbschofield.com/index.cfm/2008/9/15/ColdFusion-Evangelism-Kit

Nylon Technology Welcomes It's Newest Developer

posted: 08 Sep 2008


I guess some people are just born with it.

ColdFusion 8 Now FREE for Students and Educators!!

posted: 02 Sep 2008

Direct from Adobe:

"Academic institutions are experiencing increasing demand for students to develop ColdFusion skills earlier in their education to meet the high workforce demand for rich Internet application developers. Launched today to help fill this demand, Adobe makes ColdFusion 8 available for free to students and educators. Faculty can now easily integrate ColdFusion into their curriculum, enabling students to advance their Web application learning more quickly and easily and become more well-rounded developers.

Teachers and students can now use ColdFusion for free to connect to databases, Web services any other back end infrastructure to create Internet applications for learning purposes. Teachers can provide tandem instruction on the use of ColdFusion and other RIA and enterprise technologies, equipping students to graduate with comprehensive career skills in building RIAs and enterprise applications. Adobe ColdFusion 8 is now available free for download to eligible students and educators through https://freeriatools.adobe.com/coldfusion/"

Hallelujah!

Two Events To Learn Flex on a Budget in September

posted: 22 Aug 2008

There are two upcoming events that are both a great deal for anyone who wants to learn Flex on a budget. The first is bFlex (http://bflex.info/) - a free hands-on training event in Bloomington, Indiana on Sept. 7th (preceded on the 6th by bFusion, a free day of ColdFusion training). The second event is 360 Flex NJ (http://www.njflex.com/) - a 2 day Flex event being held on Sept. 26 and 27 just outside NYC in Montclair, NJ and offered at just $75 a day (day one is a single all-day training session and day two is composed of several sessions from well known speakers in the area).

Back in My Cave

posted: 03 Aug 2008

After 3 days away from home, 9 hours of presenting, and several phone calls and voice mails from my adorable 20 month old, I decided I prefer my cave more. Ishaan, who's just starting to put together sentences, is absolutely in love with me and left several "I love Papa" voice mails. Those of you who have had kids and remember what it's like when they begin speaking and crying out for you a lot will understand. It broke my heart and I decided that I'm just not into being away from home anymore.

Professionally, what this means is that I've decided that I'll get more involved in the activities that I was better known for to support the community back in the good old days before we even had any CF Conferences - namely writing and speaking at user groups.

Those of you who were interested in seeing my presentation at the conference, I apologize for leaving early but hope that you will be happy to know that I'm going to record (Adobe Contribute) it from home for Liz, that Simon Free will be presenting it for me at the conference on Saturday, and that I'll write about the topic and post here as well.

Microsoft Loves Outerspace... and Flash!

posted: 03 Aug 2008

A colleague just sent me a link to the Microsoft Research "World Wide Telescope" site (http://www.worldwidetelescope.org/). The project looks pretty cool and if you're into space or images of space, definitely check it out.

I've got to admit that I was really surprised that they built the entire site with Flash/Flex rather than Silverlight. If I'm not mistaken, this is EXACTLY the type of site for which Microsoft totes Silverlight as being the ideal development/deployment platform. Anyone from Microsoft read my blog and care to chime in?

Not that I'm complaining, mind you... it's a slick use of Flash. Well done, MS.

What have I been up to lately?

posted: 03 Aug 2008

So, a lot of people have noticed and commented to me about dropping off the face of the world (from a CF Community point of view), so I thought I'd explain what I've been up to. As I've mentioned a few times in posts recently, my priorities in life definitely have changed since my son was born. He's put what's really important in life into perspective for me, which has definitely had a lot to do with how quiet I've been for a while.

I should begin by mentioning that I haven't at all stopped supporting the community, I've just been doing it more at user groups, classrooms, and client sites than anywhere else. I find that in these outlets, the audience is more appreciative, information is conveyed in a more useful manner, and I don't have to deal with what can only be described as the "ridiculous political atmosphere" that tends to accompany more open forums in the development community.

Getting back to my original point: what have I been up to, professionally?

Well, first of all, I've taken the role of CTO at Nylon Technology very seriously and am trying to rise to that challenge. There are some technical challenges of course, but my greatest challenges are in growing as an executive and manager. What's particularly difficult sometimes is "letting go of the code"... something I'll write about in detail another time.

I have been doing a decent amount of internal development at Nylon to support our internal and commercial needs. I find this particularly exciting, as it's given me to develop things I've always wanted to... and most importantly HOW I've always wanted to. There is a definite possibility that we will be releasing some of this code to the public.

To grow as a developer as well as to be the best CTO I can be at Nylon Technology, I've also been spending more time with technologies other than CF. We are definitely largely a CF shop, but also do quite a fair bit of PHP and Flash (rich multimedia projects). I've also taught myself Powershell which, by it's nature, included learning much more about the .NET Framework. I'm still not a huge .NET fan, but Powershell itself is one of the coolest languages I've ever seen. Reminded me a lot of LISP in many ways, with some strong parallels to perl and python and even CF... and some nice new nuances of its own, of course. If you are into programming/scripting languages and/or are looking for the best way to administer Windows networks and machines, definitely check out Powershell.

I'm in the process of building a decent sized Flex talent pool in-house, and we've done several Flex projects and prototypes. We're also getting started on what, by my estimation, is definitely the most high profile project that I've ever worked on and, in all likelihood, will be the most high profile project on the web built entirely with Flex and CF. I can't say anything more about that at the moment, but it is very high profile and the contract has been signed, so you'll definitely hear more about it in the future. I can't wait to talk about that!

I've also built new development and staging environments at Nylon, complete with source control and a web-based server admin and project-build (deployment) interface created by yours truly. This is part of a slow introduction of new development methodologies and project management policies and procedures.

Yes, I've been busy... and what I've said here only scratches the surface. More to come (much more) including, among other things, my thoughts about the future of ColdFusion.

A CF 8 Race Condition to Avoid

posted: 03 Aug 2008

I recently stumbled across a scenario in which what appears to be the most flexible way to write some code ends-up introducing a somewhat nasty race condition that breaks your ColdFusion 8 application. In Application.cfc you can specify application settings such as session behavior and the application name - in CF 8 you can also specify application specific custom tag paths.

It's not uncommon for a company to have a template or template files that they use when creating new applications - these "skeleton files" often contain common or "generic starting point" code that you then build upon. We have a core CFC code base that requires a mapping to use easily across every application... so I thought it made an awful lot of sense to have something like the following in our "skeleton" Application.cfc file for defining each application:
// change per app this.name = '[your_app_name_here]'; this.sessionManagement = true; this.sessionTimeOut = createTimeSpan(0,0,20,0); // change per app (add paths) this.customTagPaths = ''; this.customTagPaths = listAppend(this.customTagPaths, expandPath('path-to-our-code-library'));
Note that each application can set their custom tag path to whatever they want, and the code in the skeleton file will always append the path to our core code base to the custom tag path. Makes a lot of sense, except for one small problem: this code exists outside all of the server event handler methods, so it runs on every request. For the brief period of time between when a request runs the line of code that initializes the custom tag path and the line of code that appends the core library path to the custom tag path, any code that executes for any user that requires the path to the core code library to be in the tag path will fail.

The CFCs in the core library, as you'd imagine, are used in several server event handler methods including the onApplicationStart() and onSessionStart() methods - so the core library must be added to the custom tag path in this script block outside the event handler methods. If you don't believe me, try hitting an app. that appends to the tag path in this manner with some load. If you have long-running code blocks that rely on the mapping you will, of course, find it much easier to see the errors get generated.

So the moral of the story is, if you want to be safe, do not append to the custom tag path in your Application.cfc files - like the infommercial says, just "set it and forget it".

Lack of Snipex Security - Bug Mark Drew About It

posted: 03 Aug 2008

If Mark's anything like me, he tends to getting to things quicker when more and more people bug him about it. If you haven't taken a look at Snipex yet, you should (http://snipex.riaforge.org/). It's a CFC and tiny database schema that allows you to set-up a central repository of CFEclipse snippets. It's a great idea... but unfortunately there's no way to secure it. The CFEclipse plug-in doesn't support challenge/response authentication. Even if you want to put together a quick security hack to secure your company snipex server by requiring a URL variable that only you and your internal employees know about, you're out of luck... the plug-in doesn't appear to support that either.

I already spoke with Mark about the issue recently at CFUnited and he was 100% on-board with the idea that it should be able to run in a secure manner, and I've already created a ticket in the CFEclipse Wiki... but like I said, bugging people makes them do stuff. So if you know Mark, bug him for me!

BTW - I really only blogged about this to make people aware of the fact that if you use a snipex server, you can't easily secure it in it's current state so be careful how/where you deploy it if you need to. Don't give Mark a hard time. We're buddies and I'm sure he'll get to it when he can... AND he's taken on one of the most thankless but important jobs available in the CF Community. Keep up the good work, Mark!

Adobe Adding CMS Capabilities to ColdFusion?

posted: 03 Aug 2008

I'm not saying (nor do I know) that Adobe will or will not ever integrate Content Management System features into the ColdFusion product. It is something that wouldn't suprise me to see at some point. Let me explain why.

First, there is (was) Spectra - the Allaire CMS written entirely in ColdFusion. At the time it was an impressive example of what you can do with CF, but it had serious architectural and performance issues and, ultimately, failed as a product. There clearly is a market (otherwise Spectra never would have existed, companies like Paperthin wouldn't be alive and well, and there wouldn't be so many CF based CMS offerings available) and the first priority of the CF Product Team when deciding what new features to add to the product has always been, in my experience, features that can be monetized. In other words, the features that Adobe thinks will help sell more licenses or that their biggest spenders (paying customers) want get high priority. CMS capabilities could be on this list.

The second reason to think it could happen is to look at LiveCycle ES. About 2 weeks ago, Adobe announced that they are adding Content Management capabilities to LiveCycle ES by integrating the open source Alfresco CMS (http://www.alfresco.com/). Clearly, someone at the company not only still believes there's a CMS market out there that Adobe should go after, but this recent announcement describes a CMS in which you have CMS functionality delivering content that takes advantage of the best in data visualization, user experience, and document management by leveraging Flex 3 and Acrobat. If I were a large enterprise company (or making purchasing decisions for one) I'd want to "run out and get me some". The Adobe Press Release, by the way, is online at http://www.adobe.com/aboutadobe/pressroom/pressreleases/200806/061708AdobeLiveCycleES.html.

Getting back to the topic at hand - "why would I say that there's a chance Adobe could integrate CMS functionality into CF?" - there's a third reason, which these first two offer evidence to support. When Allaire (just prior to the Macromedia acquisition) first publicly announced and showed the Java-based CFML server that would become CFMX (they showed this in the keynote at DevCon 2000 in Washington, DC) they cited a few reasons for the server rewrite. One of the primary reasons cited in that keynote for the move to Java, if my memory serves correct, was the abundance of open source code available that they could take advantage of. Hmmm... sound familiar? If not, go back a paragraph and re-read what I said about LiveCycle ES having an integrated Alfresco CMS. I can't think of any technical or legal reason that Adobe couldn't also just integrate Alfresco with CF - so adding CMS functionality to CF isn't really such a daunting task for the engineering team, is it? The idea that CF would be made better because the CF Engineering team can take advantage of the Java Community has, so far, held-up very well. So many of the CF features are really open source Java exposed in a nice friendly way (log4J, JAAS, etc.) and CFUnited this year included a sneak peak of CF with integrated Hibernate ORM functionality.

I don't want to say anything more about the topic of Open Source Java being dropped into CF, as I do plan to write extensively about the future of CF, as I see it, in the very near future. I was thinking about the new CMS functionality in LCES and it got me thinking... and I just thought I would share. By the way, with regards to whether or not integrating CMS functionality into CF would be a good thing or not, I'm on the fence. There's definitely a large part of me that really detests the idea, but in all honesty I couldn't blame them... it probably would help sell a lot more servers. It would, unfortunately, most likely put a lot of CF developers out of a job, too. What do you think?

The great frameworks debate

posted: 26 Jul 2008

This past week at the New York Flex User Group, Yakov Fain compared and contrasted 3 Flex frameworks (Cairngorm, PureMVC, and Mate). Yakov also showed an application his company is planning to release that is a code generator - creating both server and client side code (very similar to the Flex Builder CF wizard for building an LCDS app, only a bit more robust in the amount of code it generates and the options for server side technologies). The evening began with a quick examination/explanation of Flex itself, as a framework.

Attendance was great (60 people) and audience interest and participation was extraordinary. When the end of the presentation turned to an open discussion, it took very little time for the age old frameworks debate to ensue. Those of you who know my love for stirring the pot when it comes to topics like this may be surprised to know that I didn't get too involved in the actual framework "yes-no" side of the discussion. Even so, it felt funny being outside the CF world and getting stuck in the middle of the same religious debate that we CF developers are all too used to.

Actionscript is a language that I feel frameworks can bring a lot to when architected well... but I also feel that the Flex Framework alone is sufficient for most projects - especially given the size of the average Flex app. That said, I had never seen Mate before and after seeing Yakov's preso. thought that it looked pretty slick - I definitely plan to take a closer look at it sometime soon.

Getting back to the meeting itself, conversations lasted well over an hour after the meeting had ended. Though I don't want to fuel any fires, it's hard to ignore the enthusiasm and attendance witnessed at the meeting. So, I'm planning to hold a debate on Frameworks in Flex at an upcoming meeting. It will be a properly run debate with tables, time limits, and moderation. If anyone who reads this feels strongly about the topic of Flex frameworks (on either side of the argument), and thinks they'd make a good member of the debate at the table, please let me know (simon at horwith dot com). As soon as I've got a good team for both sides of the debate, I'll schedule it for an upcoming meeting.

Apache default document interferes with the ColdFu

posted: 22 Jul 2008

A developer in my office recently reported an interesting problem to me that they couldn't figure out. In the onApplicationStart() method in Application.cfc (on CF 8), an application variable was declared which stored the relative path to the root of the app. Another application scoped variable was then declared to hold the absolute path to that directory - it's value was dynamically determined using the ColdFusion expandPath() function. The code looks something like this:

application.relativeRoot = '/path-to-app-root-directory/'; application.absoluteRoot = expandPath(application.relativeRoot);

The code looks fine, right? One of the uses of the absolute path variable was to read-in some XML files... but no matter what he did he kept getting file/directory not found errors whenever he used the application.absoluteRoot variable. It turned out that the value of the variable always had "index.cfm" appended to the end. The server was running using Apache as the web server, and index.cfm was declared as the default document. According to the CF documentation, expandPath works by appending a relative path to the base path, and the base path is defined as "the currently executing page?s directory path" which is "stored in pageContext.getServletContext()". Java ServletContext objects get a lot of their information from the web server. I was under the impression that this information was defined and stored within the JRE when it instantiates, but apparently not (I assume an internal HTTP request is being made).

BTW - the "fix" was to not put a trailing slash in the value for the relative root, which prevented 'index.cfm' from being appended. This is fairly annoying because it means having to add a slash everywhere in the code that uses the variable... but it works ;)