The Dopefly Tech Blog

<< The Dopefly Tech Blog Main page

Book Report - Object-Oriented Programming in ColdFusion

posted under category: General on March 21, 2011 at 1:00 am by MrNate

I am finally up to books that are new in the past few months! This is Matt Gifford's new book Object-Oriented Programming in ColdFusion. I know Matt, he's a great person, and that alone is reason enough for me to pick up his book. Problem solved. I recommend it. End of discussion.

But, who do I recommend it to?

Object-Oriented Programming in ColdFusion starts off with the lighter stuff, CFML tags and concepts that enable object-oriented development, but then includes enough of the gritty details so you don't hang yourself as soon you realize how much rope you've been given. It is very commendable how much of the important facets of CFC development Gifford fits into such a quick and entertaining first pair of chapters.

After the basics and theoreticals come the practical use. I love the way this book shows how easy it is to gain an advantage using OOP concepts. Real life discussion and demonstration of Beans, DAOs, Gateways and Services to complete the journey.

This book is very practical. It move straight from book to brain to program in a way that most will be able to follow and with a formula that will bring you near-instant success.

If you do ColdFusion development and want to know why there is all this fuss about object-oriented programming, you need this book! If you have some OOP knowledge and wanted to translate it to a real program, get it. If you are struggling with the right way to design your objects, this could be your key to success. Also, if you've been doing OOP for a while and want to know if you are doing it right, this is how you find out.

On the other hand, if you are one of the elite few hackers that invent new names for types of classes because they haven't been invented yet, maybe you don't need it. If you are an OO purist who hates to see when someone uses inheritance over composition, you may not be helping yourself by reading through.

Over all, I hope that this book makes it into every store shelf that holds a copy of any ColdFusion book. The information here is so useful, so helpful, so good, I wish everyone would follow Matt's recipes for successful object-oriented application development - the world of CFML would be a different place. Applications would all make sense. All of our concerns would be separated. All of our knowledge would be well encapsulated in our models. Simplicity would reign. Think of the children! [maybe I'm going too far with that last one... how about this:] Think of me! I don't want to maintain another awful CFML app. Buy this book already! That's my plea. Thank you.

You can learn more about it at the publisher's site, or you can pick it up at Amazon for about $35 today.

Finally, if you want my copy, I plan to give it away at the AZCFUG meeting this Wednesday (March 23). I'm a polite reader and it's in almost perfect condition. Show up if you want it.

Too old to comment!
On Mar 21, 2011 at 1:00 AM Justin Scott (leviathan sends love to said:
I picked up this book about a month ago and gave it a read. I read "The Object Oriented Thought Process" by Matt Weisfeld first to get a good foundation in OO theory and concepts before going into the CF-specific book. I was able to read Gifford's book with some fresh background knowledge.

As I was reading it, one thing that struck me was that it was heavy on the "how" but pretty light on the "why". He gave a lot of examples which did not fully explain the reasons that things were being done the way that they were. All through the book there was use of a "variables.instance" structure, but no explanation of why that is or isn't better than setting individual variables. There was little to no explanation of the CFPROPERTY tag, where or why you would use it, etc. I don't recall a decent example of how composition should be done (or why you'd do it that way). Toward the end of the book there were a lot of generic editing issues which made it feel unpolished and rushed. Overall I'd give it a 3 out of 5 for the content that's there, but I just felt it could have been a lot better. I am glad I read "The Object Oriented Thought Process" first as it goes into a lot more detail then Gifford does on generic OO theory which is really where one needs to start. As for the price, I ended up returning my copy to Amazon because I didn't feel like I got enough value out of it to justify the price. I hope the gaps can be filled in and the editing errors corrected for a second edition. I'd certainly be willing to pick that up and give it a chance.

On Mar 21, 2011 at 1:00 AM Nathan Strutz ( said:
It seems to me that so many CFML hackers out there need specific help with the practical aspect of OOP. There have been absolutely innumerable discussions on how switching to OOP is hard and how doing it the "right way" seems impossible. Far too many CF devs have chosen to leave themselves in the dust because they are afraid, unwilling or too uneducated to take the leap. I would argue that this book bridges that gap perfectly.

The point you made about variables.instance not being explained didn't really matter to me. I see the code, I notice it's a struct, I move on. The cfproperty tag was explained briefly - and better than Adobe's documentation does - that it translates straight to metadata and CF9's automatic accessor/mutator creation. Also, on how versus why, I thought was evident as soon as the application started to come together, IMO.

I wonder how much you already knew about OOP and CFCs before you read the book - perhaps you had already moved beyond what it could offer. You seem like a smart guy, maybe you fall into the "don't need it" category. But for recommending it, put yourself in your co-worker's shoes, or those of a newbie, then inherit all of their applications and you will wish and pray that every one of them would have read this book.

I'm not saying there isn't room for improvement. I am saying that this book would be helpful for many.

On Mar 21, 2011 at 1:00 AM Justin Scott (leviathan who spends every waking moment visiting said:
I agree the book does give good practical advice that can be picked up and ran with pretty quickly. I suppose I prefer to know the reasoning behind things like the "variables.instance" structure. I see it over and over again in CF OO discussions, but never a clear statement of the reason behind doing it that way, yet everyone seems to follow the pattern. I've not seen anything similar in any other OO reading about other languages, so it seems a little odd.

As for CFPROPERTY, perhaps my mind is simply expecting something more out of that from the language and I just feel as though something's missing in the explanation when it's actually not. I keep having this expectation that I'm going to read about the "property" scope somewhere with an explanation of how to define a property as public or private. Maybe it's not that the book isn't complete in that area, but that Adobe simply designed that part of the language in a way that doesn't make sense to me. Public variables in the "this" scope, private variables in the "variables" scope, and properties that have nothing to do with it (unless you're using ORM) just feels like the wrong approach so I keep expecting it to be different.

I agree that for someone without any experience with CFCs or is more of a novice the book would be a lot more valuable than it was for me.

On Mar 21, 2011 at 1:00 AM Nathan Strutz ( said:
Justin, great points here. I plan to address variables.instance some other time, but the cfproperty thing, you totally hit the nail on the head. It's basically a useless tag, and you can put literally any attributes you want on it. Like I said, you're a smart guy. Properties really don't make sense. They're not enforced or checked anywhere until you move into ORM.

The original idea for the tag just made no sense to me, and I ignored it for a long time. Why would I make my CFC more self-documenting? I didn't see the need. Of course at the time, my CFCs were mostly lame function libs or query containers. I wrote cfproperty off until recently when I've been using the metadata to generate basic SQL queries and forms (fancy, no?). Maybe I'll blog that one day.

On Mar 21, 2011 at 1:00 AM Mark Gregory ( said:
I disagree about CFProperty being useless. I have found the implicit getters and setters alone worth the price of admission.
One can make Bean-ish entities in practically no time. No ORM required for benefit. I love it!

On Mar 30, 2011 at 1:00 AM Justin Scott (leviathan, who eats said:
I'm curious as to how you're getting access to the metadata you're injecting into the properties?

On Mar 30, 2011 at 1:00 AM Nathan Strutz ( said:
The metadata comes across from getMetaData() - any attribute you put on a cfproperty, cffunction or cfcomponent tag is visible in the metadata. cfdump the metadata and you will learn all kinds of things.
Too old to comment!