I like Joe’s Goals and I’m glad to see that Ian Smith is making something out of it. On top of that, I never even noticed that it was written in ColdFusion and, at the end of the day, I don’t care. Obviously someone’s choice of programming languages is like their choice of pizza toppings and people agree and disagree about those things all the time.
Of course none of that changes the fact that ColdFusion is rubbish. AJAX widgets or not, it’s based on Java, which means that it’s full of memory leaks. Why? Abysmal garbage collection (wait, it has garbage collection?) ColdFusion has some things about it that are very likable. Among them:
- Really sweet SQL query inline syntax
- Tag-based statements mingle effortlessly with HTML
- Easier to learn than Chinese checkers
Unfortunately, it’s horrendously inefficient in manipulating text, has the least consistent syntax of any language I’ve ever used (example: structkeyexists takes the arguments structure followed by key, whereas find takes the arguments substring followed by string. Why couldn’t they have put the thing you’re looking for either first or second in both cases? It’s hard to remember syntax when it’s full of exceptions), and is rife with logical oddities that you don’t find in any other language (example: the literal string “no” evaluates to false, though all other literal strings evaluate to true. The compare and comparenocase functions return some weird comparative result, so if the two strings are the same, the result is negative, which fills your code with tests like NOT comparenocase(). None of that would be necessary if the EQ operator wasn’t twice as slow as comparenocase at comparing strings. I’m glad they thought that one out fully.)
I use ColdFusion daily and I derive much pleasure from solving programming problems and implementing efficient solutions in any language, but sometimes it gets under my skin!
“has the least consistent syntax of any language I’ve ever used”
I take it you’ve never used PHP then, the language with a billion functions served (and counting). Not only does it have the sometimes first, sometimes second issue you’ve discussed, half of the functions are of the form someFunction(), while the other half are some_function() (with underscore).
And actually, the consistency is there if you look for it. Any function like structXXX or listXXX or arrayXXX or queryXXX takes the struct, list, array, or query first. Other functions, like find or left or mid, come from standard BASIC syntax and use those conventions.
As to compare, such an operation gives a multiway result. The two strings are either equal, in which case the result is zero (0), the first is greater than the second (1), or the first is LESS than the second (-1).
“so if the two strings are the same, the result is negative, which fills your code with tests like NOT comparenocase().”
As stated, if they’re the same, the result is zero, so you’re wrong on that score. but logically, zero is false and one and minus one, being non-zero, are true. So NOT comparenocase() works, but not for the reason stated. Better to actually say comparenocase(x,x) is 0.
And if you don’t know why a dedicated function is faster than a generic operator that has to check and potentially coerce variable types…
I misspoke,
comparenocase("a", "a")would return 0. My point remains regarding the awkwardness ofNOT comparenocase()constructions.Hate to differ with you, old bean, but “it’s based on Java, which means that it’s full of memory leaks” is a right bit of nonsense. If it were true then every Java application on Earth would leak memory, which they clearly do not, although many of them consume more memory than you might expect. Java’s garbage collection is probably better than that of any other GC’d language, up to and including the scripting languages. Unfortunately, you can leak memory even when your objects are being garbage collected; see e.g. http://www-128.ibm.com/developerworks/java/library/j-jtp01246.html. In this particular instance we must look to the programmer, not the framework.
Though I agree with you that ColdFusion sucks.
Okay, okay, you’re right, I was just being vindictive. Nevertheless, ColdFusion refuses to release its memory, and whenever a custom tag or component is called, it spawns a new thread. Normally this would probably be a benefit, but in our case it eventually depletes our server resources and we have to restart all the ColdFusion services.
Also, let’s not forget that ColdFusion has the worst documentation I’ve ever seen (their LiveDocs site is a complete joke compared to the documentation of PHP, Ruby, or even Perl).
One of the most interesting and useful features of ColdFusion,
CFSCRIPT, is woefully undocumented and lacks the ability to do queries, though it can access queries performed outside of the script block.It’s a commercial product that in my dealings with it seems like nothing more than a low-rent OSS project maintained out of some Dutch kid’s basement. Though if that were true, the docs would probably be better…
“ and whenever a custom tag or component is called, it spawns a new thread.”
What on earth are you talking about? The CF runtime absolutely does NOT spawn a new thread for every custom tag or component.
In fact the server uses a thread pool for dealing with requests (like every other application server). Each request, however, is single threaded unless you’re using in CF8 or you’re dipping into Java code.
I’m not sure about your issue with the compareNoCase() method either. It’s just a wrapper around Java’s Comparable#compareTo() method. In fact .NET’s comparable interface does the same thing, so does ruby’s operator…
Anyway, I seriously doubt the bottleneck in your application lies in the eq operator.