Why Use Object Orientation?

When i first came across a few examples of objects, it seemed to me like they contained a lot of "extra" code that did a lot of extra work for no good reason. Various authors i read extolled the benefits of object orientation to no end, but it was hard for me to see those benefits by looking at examples. For instance, check these 2 code samples out:

<cfscript>
person = StructNew();
person.fName = 'George';
person.lName = 'Smith';
person.age = 35;
</cfscript>

It's nice and simple. Our structure encapsulates our data very nicely in one package. Now let's do the same except use an object. Give me a few minutes to type all this out! ;-) ...

[More]

Instantiation

When i first started learning about object orientation, i remember seeing the word instantiation or instantiate or instance and having only a vague idea what it meant. So maybe that's a good place to begin.

In object orientation, there are 2 terms you will see used a lot. One is class, and the other is object. Sometimes they seem to be interchangeable. But there is an important concept to grasp here.

When we code a CFC, what we have is really a blueprint, a class in object oriented terms. So essentially, the word class refers more to the blueprint that you write in code.

[More]

Object Orientation in ColdFusion is Probably Simpler Than You Might Think

I have a lot of compassion for anyone learning on their own, confronting CFCs, object orientation, the slew of frameworks that use CFCs in an object oriented manner all at the same time. It's overwhelming, especially for someone with no formal education in programming.

When CFMX 6 came out and CFCs were first introduced, i bought a book by Hal Helms called Discovering CFCs. He introduces some basic OO principles in there, all of which are pretty easy to understand in theory. Then he starts off showing examples. I still remember how disconcerting it was to not be able to understand. And i couldn't put my finger on what it was that i didn't understand.

Looking back, i think there were a lot of little pieces i just didn't get.

[More]

CFC's and Object Orientation

Newbie Cafe

I've always wanted to write something up about CFC's and Object Orientation from a newbie's perspective. I learned ColdFusion on my own using books and mailing lists and forums, coming into it from having learned HTML and CSS on my own. So i've never had any formal training in programming.

I suppose a lot of people have learned CF that way. I also work alone, so i don't get the opportunity to rub shoulders with people more experienced than i am too often.

When CFC's first came out in CFMX6, i resolved that i would learn OO, largely influenced by Hal Helms. I bought a bunch of introductory books, studied them carefully, read everything i could online, downloaded MachII once it became available and got utterly lost. While i understood the theory of OO fairly well from the get-go, i had no idea AT ALL how to implement it in practice. It was downright embarrassing - ok ... humiliating.

[More]

BlogCFC was created by Raymond Camden. This blog is running version 5.1.004.