ColdFusion / Lucee

ColdFusion is a commercial rapid web-application development computing platform created by a company called Allaire in 1995. The programming language was a scripting language commonly known simply as CFML. It was designed to make it easier to connect simple HTML pages to a database, but quickly developed into a full scripting language. At the time, PHP had just been introduced, but was not only more complicated that ColdFusion, but not nearly as powerful.

What is ColdFusion / Lucee / CFML

ColdFusion became very popular for enterprise applications, while PHP became the scripting language of choice for those that could not fork out the $1,000+ price tag for a ColdFusion license.

Over time, ColdFusion became more obscure as PHP grew in both user base and power. Much of this was due to the fact that ColdFusion kept its high price tag, and was sold off to multiple companies. It sold to Macromedia in 2001, and then again acquired by Adobe in 2005. With each of these, it became less of a main focus for the purchasing company. But it has gone through fourteen major revisions, and continues to be developed today.

However, competing projects came to light over time, releasing open source implementations of CFML. These included BlueDragon, Ralio and Lucee. Of them, Lucee has remained the most updated with the largest following. So much so, that many argue that Lucee is better than the proprietary Adobe ColdFusion. Best of all, it is free and open source.

Why CFML?

In a world with seemingly endless options for web scripting language, what makes this twenty-six year old dinosaur something to consider? In a world, it is easy, as in stupid easy. You can make simple dynamic database driven websites using CFML with little more than basic knowledge of HTML. You simply learn some CFML tags that look a lot like HTML. So much so, that if you look at the source of a basic CFML page with only HTML knowledge, you can generally understand exactly what is going on with zero CFML knowledge. Another great reason is backward compatibility. If you wrote an app 26 years ago using Allaire ColdFusion, you could drop the same app in an instance of the latest version of Lucee or ColdFusion, and it would just work. You don't need to worry about porting your project with every new release.

How Easy Is It?

Consider everyone's first app, Hello World. Here is what is looks like in CFML:

<cfset hw = "Hello World">
<cfoutput>
#hw#
</cfoutput>

Want to send an email to someone from your web page? It is this easy:

<cfmail to="someone@someone.com" from="me@me.com" subject="Sample Mail">
  Dear You,

  This is an email to you.
</cfmail>

Want to make it a little more complicated. Here is how we deal with variables and an email:

<cfset toAddr = "someone@someone.com">
<cfset fromAddr = "me@me.com">
<cfset subject = "Sample Mail">
<cfset toFirstname = "Jon">
<cfset fromFirstname = "Bob">
<cfmail to="#toAddr#" from="#fromAddr#" subject="#subject#">
  Dear #toFirstname#,
  This is an email to you.

  Sincerely,
  #fromFirstname#
</cfmail>

The resulting email would look like this:

Dear Jon, This is an email to you.

Sincerely, Bob

What About Database Connections?

Do you know some basic SQL? No problem. Let's assume we have a database called clients with a table called contacts. Our email might look something like this:

<cfquery name="mailDBQuery" datasource="clients">
    SELECT * FROM contacts
    WHERE toFirstname IS "toFirstname"
</cfquery>

<cfoutput query="mailDBQuery">
    <cfset subject = "Sample Mail">
    <cfmail to="#toAddr#" from="me@me.com subject="Sample Mail">
        Dear #toFirstname#,
        This is an email to you.

        Our database says your first name is #toFirstname# and your email address is #toAddr#

        Sincerely,
        Bob
    </cfmail>
</cfoutput>

It is that easy, and if you had written this 20 years ago, it would still work with the most updated versions.

To see more about the CFML scripting language, there is a great site dedicated to how to do just about anything located at CFDocs.org, and there are some great tutorials at QuackIt. But google just about anything you want to do and add CFML in the search, and you will likely find it quickly.




Blog Comments powered by Disqus.