Introduction to ColdFusion

Epicenter Consulting Blog

Many clients have heard of ColdFusion, or their developer will say “yes, I’ve dabbled in ColdFusion a long time ago.” Just as many business owners have no idea what ColdFusion is, or the basics of how it works. Sometimes a stakeholder will know that their website runs on ColdFusion, and that’s all. The goal of this post is to make even the most non-technical person understand from a high level what ColdFusion is and how it is used to create dynamic, web-based applications quickly, efficiently, and professionally. Consider this your 10,000-foot view of what ColdFusion is, how it works, and why it’s a modern, safe, and mature development platform.

 

Okay… get ready. Here’s the technical description.

You’re not expected to understand what much (if any) of this means:

“ColdFusion is a server-side java pre-parser that turns ColdFusion Markup Language (CFML) into Java bytecode for handling of web server requests. CFML pages are pre-processed on the server and Java bytecode classes are dynamically created that act as page handlers for incoming web server requests.” Wikipedia page for ColdFusion

 

There’s a lot there, so let’s unpack it a bit at a time.


When the internet first started, websites were static. They didn’t deliver dynamically generated or changing content. If you wanted different information on your home page, a developer needed to change the code. Very little happened automatically.

These days, websites are completely dynamic, interactive, and constantly changing. Whether it’s requesting information about a flight, or receiving the most up to date score on a sporting event, websites today rely on being able to deliver dynamic, automatically generated content to keep data-hungry users satisfied. ColdFusion was invented to accomplish this very task. Created in 1995, ColdFusion was originally designed to allow simple, static HTML web pages to access information stored in a database. These days ColdFusion is more dynamic, secure, and offers more interactivity than ever.

 

First things first, you need to know what “ColdFusion” is.


Many times developers will use the word ColdFusion when they really mean CFML. ColdFusion is a software product owned by Adobe, Inc; the inventors of PDF documents and the makers of Photoshop, Illustrator, After Effects, Flash and many other software products. CFML is short for ColdFusion Markup Language, which is the language that gets interpreted by the ColdFusion Server software. The difference between the two is this: CFML files are written and stored on the web server. They are then passed to the ColdFusion Server software to be parsed and interpreted.

Consider the lifecycle of an internet request. For sake of example, let’s say you open a browser on a computer or your mobile device/tablet. You enter a website address into the address bar, epicenterconsulting.com, and hit submit. In a split second, a lot of activity and communication between your device and the Internet happens.

 

  • Your device figures out if it already knows where epicenterconsulting.com exists and if so, it requests the website directly from its web server.
  • If your computer doesn’t know where epicenterconsulting.com exists, it talks to a Domain Name Service (DNS) Server. The DNS server knows, or knows who to ask, where all websites on the internet are located. It looks up the server that is hosting epicenterconsulting.com and passes that information back to your device.
  • At this point, your device requests the website from the server that hosts it.
  • That web server receives the request for the website and attempts to deliver it. That’s where ColdFusion steps in.
  • Before the web server delivers www.epicenterconsulting.com to you, ColdFusion looks at the source code for the page being requested. It reads the CFML and parses it out into plain HTML, which is read by the browser. Then, it passes the parsed HTML file back to the web server.
  • The web server then takes the HTML file, sends it to your computer, fulfilling the request.

This, of course, is a simplified version of the entire process, but the overall concept is accurate. Your device makes a request. The web server receives it. ColdFusion pre-processes the code and hands plain HTML back to the web server who, in turn, serves it to your device.

 

But how does it process the information?


That’s where the language, CFML, comes into play. CFML is a dynamic language that has evolved over 20+ years. It has become more flexible and standards oriented over the years. What started out as a basic tag-based language in 1995 is now a dynamic ECMA-script compatible language that is extremely flexible in its implementation. The ColdFusion Server reads CFML and performs some magic under the hood to create Java files that handle the page.

Let’s say, for example, that I am a developer who has been tasked with a very simple task: Display the current date at the top of the website. Without some dynamic pre-processing of the HTML file, I would need to log into the web server, download the page, change the date, save the file, upload it to the server and the date would be changed. It’s slow. It’s painful. It’s manual. And it’s a complete waste of a developers time.

By writing some simple CFML code, I can accomplish this task dynamically and never have to do it again.

 

Here’s how some simple CFML looks:

<cfoutput> #dateFormat(now(),’m/d/yyyy’)# </cfoutput>

 

And here’s how the ColdFusion Server would interpret that code:

<cfoutput>

 

This is a tag that tells the ColdFusion Server, “Look out! There’s going to be some code in here you’re going to want to process!”

#dateFormat(now(), ‘m/d/yyyy’)#

 

There’s a few things going on with this line of code, so I’ll break it down one piece at a time.

 

  • The pound signs (or hashtags) tell the ColdFusion server that whatever is in between them needs to be processed.
  • dateFormat() and now() are ColdFusion functions.
    • dateFormat() is a ColdFusion function does just that… it formats a date using a mask supplied. In this case, the mask I am supplying is “m/d/yyyy” which means “one or two digit month, followed by a slash, followed by a one or two digit day, followed by a slash, followed by a four digit year.” If this mask were to be applied to New Year’s Day, 2020, it would read “1/1/2020.”
    • now() is a ColdFusion function that displays the current date and time from the server. Remember that ColdFusion runs on the server side, so the date being displayed in this example would be the date from the server.

In the end, these three simple lines of code tell ColdFusion to replace the content within with the current date, formatted in m/d/yyyy format.

Again, these concepts are very basic examples of how ColdFusion works and what it does behind the scenes. Developers with some experience can pick up on ColdFusion very quickly, and seasoned ColdFusion Developers (like those at Epicenter) are masters of turning CFML into dynamic data-driven web based applications; and I didn’t even touch on it’s advanced applications like PDF manipulation, data processing, API creation and consumption, automation and much more.

As a development technology, ColdFusion is a stable, easy-to-learn, easy-to-manage platform that does just what it’s marketing says; makes hard things easy for coders across the world.  

Related Content