One 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.
- What is Programming?
- Proper Syntax
- Variables and Data Types
- Conditional Processing
- Arrays and Structures
- Modular Code
What is Programming?
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.