When I was first introduced to ColdFusion, I was against it. It was version 5.x at this point, and I couldn't see anything about it that I liked. My counterpart on the East Coast had been using it for years and was a seasoned ColdFusion programmer. I was a seasoned PHP programmer who had just completed a major project for my department, and was now being asked to move to ColdFusion to come into line with worldwide operations. I was a rogue developer with my FreeBSD PHP Web server and I didn't fit with the Microsoft world I was working in.
My company sent me to the East Coast to talk to this developer and to learn more about ColdFusion and why it would be a good move for us. Of course, I was skeptical; ColdFusion was a rich man's language in my eyes. With the server costing $1,300 or more, not including the cost of MS Windows, etc., I couldn't see how my little section could afford to make the leap. I spent a week on the East Coast shadowing this ColdFusion programmer, and when I left to come home, I had a stack of ColdFusion books and a new respect for the language.
Many of you, I'm sure, have at some point had to look at an alternative language for Web development. It's not easy to move from a language you know, love, and have spent months or years mastering, to one that seems completely foreign. This is what faced me when I was asked to switch from my happy PHP world to the dark side of ColdFusion.
Just over two years later, I'm a 100% ColdFusion shop. Sure, I still talk about PHP, and I still recommend it here and there, but I've learned that I can do things faster, cleaner, and -- believe it or not – more cheaply than I could with PHP. You might be skeptical now, as I once was, but I hope that by the end of this article, you'll start to see enough of the light to realize ColdFusion isn't the dark side after all.
First, some background on the ColdFusion language for those who are totally in the dark about it.
ColdFusion was originally developed by the Allaire brothers in 1995. This then started the Allaire Company, which was later bought by Macromedia. Like most Web languages, it was meant to provide Web developers with a way to talk to a database and display data on Web pages. As with many such languages, in the early days, it was not the most advanced technology, but it was one of the more simplistic to implement, understand and use. This vision still holds true with today's ColdFusion MX (version 6.x of ColdFusion). In fact, ColdFusion was the reason Microsoft released ASP, which was being developed by Aspect Software, a competitor of Allaire that was later bought by Microsoft. So, in a round about way, all you ASP programmers have the ColdFusion developers to thank for your programming language!
Now, let's get back to the background of the ColdFusion language. Besides a history of acquisitions and changes, ColdFusion has always been a Rapid Application Development (RAD) language built for the Web. ColdFusion accomplishes this RAD claim by providing the language in a tag-based usage, which will be familiar to any HTML programmers.
Many of the other languages out there use a programmatic approach to server side scripting, which is great for a seasoned programmer, but, to someone who's spent most of their time with HTML tags, this can be a little daunting. A ColdFusion tag always looks like with the "TagName" being replaced with the actual tag you are using. Similar to the way PHP uses the and ASP uses <% to signify the start of code, the tells the ColdFusion server, "Hey, here's some ColdFusion to process".
Most ColdFusion tags have an ending tag that makes up a tag pair. Like HTML tags, CF tags end with . So, for example, you could use the following code:
Both the and tags are the starting tags; the and are there respective ending tags. As you can see from the above example, you can have code between tags, and you can even nest tags if your application so needs them.
You've just seen a very short snippet of ColdFusion code. It's not my intention to teach you ColdFusion here, but to provide you with enough knowledge to make you curious to check it out further. To learn more about ColdFusion tags, aka ColdFusion Markup Language (CFML), visit the Macromedia Website or browse many of the fine articles here at SitePoint.
ColdFusion Myths Debunked
You now have some very basic background information on the history of ColdFusion and how its tag-based language works. But, I'm sure you are not sold on ColdFusion yet -- in fact, you're probably thinking much like I was as this point. Let's dive into some of the myths and misconceptions about ColdFusion, so we can clear the air a bit.
Myth #1: ColdFusion is a Rich Man's Language
False! Yes, if you go to Macromedia's Website and look up the ColdFusion server, you'll see a sticker price of $1300 for the standard edition, and if you head over to Zend's Website you can purchase their PHP Performance Suite for around $1875. I know you don't need the Performance Suite to run PHP applications, but the Performance Suite gives you "Dynamic content caching, Code acceleration and File compression technologies, as a single solution", which is what the Macromedia ColdFusion server gives you out of the box.
This is a good time to point out that Macromedia doesn't charge for development servers, just for the actual production server. So, what happens when you go to production? Well, if your group has the budget, you can purchase the Macromedia Standard or Enterprise versions, or you can opt for a free version of the ColdFusion server. Besides the developer edition, download any Macromedia ColdFusion server and, after 30 days, it becomes a full-featured developer edition.
A company named New Atlanta has its own version of the ColdFusion Server. This ColdFusion server is called Blue Dragon and it comes in 3 flavors, just like Macromedia's servers. New Atlanta has a Server Edition, a Server JX version and a J2EE version, while Macromedia has Standard, Enterprise and Enterprise J2EE versions. The great thing about the New Atlanta Server version is that it's currently free, and there are no signs of this changing any time soon. Why is it free? It doesn't have all the CFML tags you'd get in the New Atlanta JX version or the Macromedia Standard Edition.
I've worked on the New Atlanta free server and I can tell you, it's great. It does place some limitations on the tags you can use, and the kinds of databases you can connect to (it's currently limited to MySQL, PostGreSQL or ODBC via ODBC / JDBC Bridge), but none of this is really going to impact on your development -- most of the missing tags are Macromedia-specific. Performance-wise it was really hard for me to tell a difference, though it will probably vary from application to application, and server to server.
The New Atlanta product does offer budding ColdFusion programmers the ability to deploy applications with little cost to the end users. You can even bundle the New Atlanta server with your application and deploy it all at once (special licensing is needed to accomplish this). So, ColdFusion is no longer just for the rich. New Atlanta has brought it to the masses.
Myth #2: ColdFusion is Slow
False! ColdFusion is very fast, even for someone who is just starting out and hasn't learned all the tricks.
Currently, ColdFusion MX is built using Java (in the past, it was developed on C++), and when your pages are run for the first time, they are compiled into Java bytecode. In layman's terms, your ColdFusion pages are compiled when they are first run, much like a program, and are then stored on the ColdFusion Server as binary files. If your ColdFusion server is configured with Trusted Cache turned on, then your files will be compiled only once. If Trusted Cache is turned off, your files are compiled with each page load, or when the page expires (again, a discussion of the CFML code and server configuration details to do this are beyond the scope of this article).
So, what's so special about the pages being compiled into bytecode?
Bytecode is computer object code that is processed by a program, usually referred to as a virtual machine, rather than by the "real" computer machine, the hardware processor.
(Definition from Whatis.com)
Once the ColdFusion code is compiled into bytecode, your server can interpret the instructions of your program faster, since it's in a language it already understands. Many current Web languages are interpreted at runtime, which means that they're processed and compiled each time they're run. Typically, the difference between bytecode and interpreted code on a Web page is milliseconds to seconds. Yet, these differences can add up quickly in a Web application, and could easily mean the difference between a happy customer and an unsatisfied customer.
Myth #3: ColdFusion isn't supported the way is!
Wrong again! ColdFusion has a huge community of followers and is backed by one of the largest Internet companies. You can find loyal ColdFusion followers in just about every major city across the world. They typically belong to the local ColdFusion User Group (CFUG), and are always willing to lend a hand or some teaching to help you along the way. There are also ColdFusion communities springing up all over the place.