Author Archives: Misty Spears

Programming ColdFusion 101 – Basic Concepts: Proper Syntax

Proper SyntaxThis is the second installment of a 6 part series. All sections will help to introduce you to some basic programming concepts that will all carry through and help you as you learn ColdFusion. If you are looking for any of the other installments to this series, you can get to them below.

  1. What is Programming?
  2. Proper Syntax
  3. Variables and Data Types
  4. Conditional Processing
  5. Arrays and Structures
  6. Modular Code

Proper Syntax

All programming languages use source code to create a set of instructions. Source code must follow a proper syntax to be read correctly by the application that is processing (reading) it. Let’s go take a look and see what Wiki has to say about it.

In computer science, the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language. This applies both to programming languages, where the document represents source code, and markup languages, where the document represents data.

Bleh! Way to complicated and uninteresting. When it comes to ColdFusion, proper syntax is referring to the correct usage and format of code.  Programming languages are designed to take your input, process it and give you back a result. However, if you tell the application something it doesn’t understand, it can’t give you back the result you want and instead will most likely throw a nasty error your way.

Let’s take my hat example from the previous section. I have a hat and it’s red. There are several ways you could technically tell ColdFusion that the hat is red. But the way ColdFusion understands is by using one of the following syntax:

<cfset thishat = “red”>


    thishat = “red”;

Now, if you’re wondering how we can use two different ways to tell ColdFusion that the hat is red, you’re in for a treat! ColdFusion will let you write your source code in its original tag based format or in the more programmer friendly format using more familiar coding practices. If you are new to programming in general you probably won’t see the advantage right away. So if you aren’t sure what that means, that will come later, I promise.

So what happens if we don’t use the proper syntax when talking to ColdFusion? Let’s throw ColdFusion some wrongly formatted syntax and see what it returns.

<cfset thishat = "red>

ColdFusion Error

As you can see I left out the closing quote around the word “red”. This confuses ColdFusion and it doesn’t quite know what to do with it, so since it can’t be processed, it sends you a message that there is a problem. Sometimes it’s even nice enough to tell you what it didn’t understand about the issue like it has done here.

Think of programming languages as a snobby grammar nazi that will have nothing to do with you if you don’t speak his language and with proper grammar.

In summary, proper syntax is simply the right way to talk to the ColdFusion server so that it understands what you are telling it to do. Get ready for the next installment where we will learn about variables and data types.

Programing ColdFusion 101 – Basic Concepts: What is Programming?

What is ProgrammingOne of the things I hope to do here at How to Program with ColdFusion is provide basic entry level tutorials beginning with basic programming concepts. So if you have done some programming in the past, that’s great, but if you haven’t ever programmed anything before, I’m going to get you through some basic concepts and on your way to writing your first set of code as quickly and as painlessly as possible. This series isn’t going to dive too much into actual code, instead it is intended to give an understanding on the concepts being talked about.

This is the first installment of a 6 part series. All sections will help to introduce you to some basic programming concepts that will all carry through and help you as you learn ColdFusion.

  1. What is Programming?
  2. Proper Syntax
  3. Variables and Data Types
  4. Conditional Processing
  5. Arrays and Structures
  6. Modular Code

What is Programming?

Programming is a set of instructions. It doesn’t matter if you’re programming in ColdFusion, C++, Java, Python, JavaScript or even HTML. The end result is that you are telling the computer what to do.

Let’s take a look at an example in a real world situation and see how we can compare it to programming. If you want to make a batch of cookies (write a piece of software), there are several ingredients to add and tasks that must be completed in the proper order (set of code) to get the final batch of cookies (software). If you (the computer) follow the recipe, your cookies will turn out great.

But what happens to the cookies if you don’t add the correct ingredients or you do the tasks in an incorrect order? What if you added eggs to your batter without first cracking the egg shell? Or bake them at 200 degrees instead of 350? You’d end up with some crappy cookies wouldn’t you? You might also be wondering where your common sense left you that you didn’t know to crack the eggs.

Computers on the other hand, don’t have common sense. They will do exactly what you tell them to do. That’s why accurate and precise instructions are so very important in creating good code.

Instructions in programming come through in the form of statements. You can relate a statement to a sentence. For example, let’s say I have a hat. I want to let the computer know that this hat is red. In sentence format I would simply say “The hat is red”. However, in a programming language I would write a statement such as:

set thishat = "red"

Of course the statement and syntax you use will vary depending on what language you a programming in, but the concept is the same throughout all languages. We will be touching on proper syntax for ColdFusion in the next section, so when you’re ready just continue reading.

Welcome to How to Program with ColdFusion

cfcodeHello and welcome! My name is Misty Spears and I am the person behind the screen here at the How to Program with ColdFusion blog. I am currently a Senior ColdFusion Developer at a fantastic company in Augusta, GA. I’ve been programming in ColdFusion since 1997 so I have lots of real world experience under my belt to share with you.

I originally started this blog because I was helping a friend of mine learn ColdFusion and after having written several tutorials for him on the subject I thought there might be others who would find the information useful as well. While my many years of experience in ColdFusion has let me learn some very advanced uses for it, I’m going to focus on those who are just learning the language.

My goal is to write tutorials that are written in a way that someone brand new to programming can understand. I will also provide useful information like how to setup ColdFusion, how to administer it and many other important aspects of working with ColdFusion. I will also try and share my opinion on books, online courses or workshops and anything else that might be thrown at me. If you would like to see something that I haven’t covered, just leave me a comment or send me a message to let me know what you’d like to see here.

Along with the technical side of programming with ColdFusion, I will also share with you my struggles and thoughts on on my job as a Senior Developer. While learning ColdFusion is the major focus of this blog, it’s important to train your mind to think like a programmer to solve problems that you might encounter at your own job.

I hope you stick around and decide to make How to Program with ColdFusion your first stop to learning ColdFusion. Let’s get started!