Photo credits: Matt Steen

To see more recent blog posts please visit http://www.sanative.net/blog


Why Aren't More CF Developers Using OO Methodologies and Frameworks?

I have just finished reading Bob Silverberg's blog posts on Transfer ORM. It's a five part (thus far) series on how Bob has been using Transfer over the last year. Bob is a great writer and has done an excellent job of describing what he has been doing, which left me wondering why "I still don't get it".

My overall impression is that Bob's posts were not designed as an introduction to using Transfer, but more of a way to validate how he has been using it. So, if you are wanting to learn how to use Transfer its probably not the post for you. If you've been using Transfer and want to hear someone else's experience then it's probably going to be an excellent read. As someone who has a basic knowledge of Transfer (and ORMs in general) and how it works,but being fairly new to OO development in general, I found it to be significantly enough over my head that it was not applicable to my current needs. That being said, I wanted to express my opinions on why I believe the vast majority of CF developers are still writing procedural code and not using frameworks.

To be clear, I am relatively new to OO development. I started writing "OO" CFML about a year ago and have a fair feel for what I am doing. I have written a few CFML applications using OO methodologies. Unfortunately in the last year I've written very little CFML so I've not been able to practice this as much as I would like. I learned the basic principles of OO CFML development via CFOOP. Nicholas Tunney, Phil Nacelli and Chris Turner did an excellent job of creating tutorials for procedural coders that made sense and made you feel like you actually grasped the topic. However, the the site hasn't been updated in ages.

In reality, I have learned far more about OO development from writing ActionScript applications (Flex and Flash) and the Flex community than I ever have from the ColdFusion community. This is definitely because Flex will force you into doing OO development, but there's also a larger community of developers who are proficient with OO methodologies,and to a certain degree, are better at explaining these concepts to the procedural coder.

 Here's the primary problem I have found with the blog posts and tutorials on frameworks and OO CFML development methodologies to date: There's an assumption that the reader has knowledge of many of the concepts and principles being discussed. Given that the community is ColdFusion, I feel this is often far from the truth. Talking with fellow CF developers who are not utilizing frameworks, OO principles and/or additional methodologies such as ORMs, dependency injectors and the like, I find that they have been discouraged by these facts.

While folks such as Brian Rinaldi, Dan Wilson, Matt Quackenbush and (many) others have been extremely generous in giving their time in writing articles and tutorials on advanced CF topics designed to help others learn these methods, I am certain that the intended audience has has been left with the impression that this is far more difficult than it really is. In the end, it ends up alienating the intended audience more and more because they are left to believe that they may just never get it. It is only the stubborn few who truly want to force themselves to learn these concepts and methods that actually do make it to the point of putting it into practice on a daily basis.

To be clear, OO is not easy. I realize this. It does require more effort than procedural code and is significantly more complex. However, I feel that often times terminology is the primary stumbling block. By the way, Doug Boude has a great resource for learning and memorizing OO terminology.

I would like to hear from developers who are not writing OO code. What do you think are the primary reasons for this?

Comments
Ben Nadel's Gravatar @TJ,

Over the last two weeks or so, I have been working very hard at learning Object Oriented programming with my OOPhoto series. I am trying to document every thought I have about the process and all the questions that every answer seems to raise.

To me, it is such a huge move from procedural programming that it is simply overwhelming. And, what I don't want to do is just start writing procedural code that is encapsulated in objects. At at that point, I would be getting the bare minimum of OOP usage, while at the same time, adding alllll of the overhead.

I hope that my very public display of ignorance can help others learn as well without having to know many of the terms and tokens of the OOP world.... heck, I hope *I* can learn this stuff :)
# Posted By Ben Nadel | 7/14/08 7:29 AM
Rick Smith's Gravatar I adopted using OO methodolgies with CF the minute CFCs were made available.

On the other hand I absolutely refuse to use frameworks under any circumstance. It doesn't matter what framework I use, I end up wanting to do something the framework can't do or end up customizing the framework to do what I want which takes more time to learn someone else's code anyhow. I personally find this whole framework buzz that's been going on lately to be a joke... I know virtually no one in person that actually uses them, yet the buzz amongst everyone virtually is that they're the best thing since sliced bread. I do develop websites and applications with my own set of "starter files" for each project, but every project goes in its own direction without any confinement to a structure within the architecture. I also want to know the code behind my application... when something breaks I can't tell my client "the framework is fubar". I'm just not a slap-it-together and be skippy about it type of programmer. ColdFusion permits me rapid development and ease of maintenance. Frameworks permit me rapid development, but I have no clue what's going on in the background of my application/website to call it easy maintenance. And I just don't trust someone else's code that much. Call me oldschool.

Let the framework fanboys begin the flaming....
# Posted By Rick Smith | 7/14/08 7:39 AM
Larry C. Lyons's Gravatar @Rick

"Let the framework fanboys begin the flaming...."

Um rick given your rant, aren't you being as much of a fanboi as the frameworks fanatics? Frameworks have their place, especially with very large scale or very complex apps. For instance ColdSpring with its OIC makes it a lot easier to keep track of multiple interdependent objects or those apps that require at least some dependency injection, such as when you have a view object that requires its associated model to display the data via accessors. It becomes more critical when you are looping through an array or struct of objects and having to display the results. Do you want to have to remember the specific details for each and every cfc path, for instance org.cfc.common.webCommon.client.presentation.[put your cfc name here]? To me its a lot simpler just to refer to application.cs.getObject("cfcName").

The thing about frameworks is that they are supposed to make the job easier.

regards,
larry
# Posted By Larry C. Lyons | 7/14/08 8:37 AM
Mike Rankin's Gravatar @Rick,
What does your framework do when you have two objects with the same name? Haven't you just blown apart the concept of packages?

Personally, I don't have any problem specifying the real signature for my components, especially since I have tools in both dreamweaver and cfeclipse that let me browse my components.
# Posted By Mike Rankin | 7/14/08 8:56 AM
TJ Downes's Gravatar @Ben

I did notice your OOPhoto series and have been watching it with some interest. I think you and I are very similar: We both know how to write web apps and do them well, except that we write procedural code. I know that if I could focus writing CF code more I would probably be way further ahead than I am, but I am also running a growing business and most of the CF apps we are doing I assign off to other staff. That's another blog post entirely :) I am definitely interested to see your opinions a year from now! Would you tend to agree with my thoughts?Primarily "It is only the stubborn few who truly want to force themselves to learn these concepts and methods that actually do make it to the point of putting it into practice on a daily basis."?

@Rick
I know where you are coming from. I was there a few years ago. For many, OO in CFML makes little sense. You work by yourself on small applications. Frameworks will only get in the way, and also add a lot of overhead to a project. HOWEVER, frameworks do have their place and it is important to know where and when to use them. Frameworks become critical when you are working on larger projects with a team. You ever dive into someone else's application and are like "WTF? Where do I start? WTF was this guy thinking?" Frameworks are the solution to that problem. it is a common coding method that allows you to jump into a application someone else has been working on and know exactly what you need to do to accomplish your goals. Some people do overuse them, but many of the smart folks in the CF community will advise you to know when you need to use a framework before you just start using them. Sean Corfield and Mark Mandel are two of the brightest minds in our community. Not only due to their brilliant programming capabilities, but because they have the sense to tell us noobs that we need to know why we are implementing frameworks and methodologies before doing so.
# Posted By TJ Downes | 7/14/08 8:57 AM
Rachel Lehman's Gravatar I don't think there can ever be too many blog posts or articles or tutorials on the basics of OO design with CF. While there's a good bit of information out there, I did struggle initially with the terminology that the experts throw around. There's also plenty of info on the specific terminology and definitions, but not so much info how and when to use them in development - I think that was the biggest disconnect for me. Yes, I understand the concept of a value object, but how does it change my development? I don't need another explanation of "what is OO", I need to see more examples of how to apply those ideas to real applications. A couple people have done good presentations that helped me make sense of it all, I believe by Sean Corfield and Joe Rinehart in particular although I don't remember the titles.

And I agree with you, Flex really helped it click for me. So did using a Framework, which got me past the "how do I structure my app, now that I have all these objects?" question.

BTW, I have never run into the "limitations" with frameworks that many framework curmudgeons seem to complain about. Methinks these people are trying to force their old way of development into a framework, rather than changing what they write to leverage it.
# Posted By Rachel Lehman | 7/14/08 2:38 PM
Sean Corfield's Gravatar I'll be very interested to hear why folks are struggling to learn OO or even rejecting OO altogether.

I think it's very telling that Rick doesn't trust other people's code. How on earth can you work in a team environment if you don't trust other developers? Isn't part of the learning experience to hire / work with people who are better than you so you can leverage their skills? That's one of the (many) benefits of using a framework - you get to "stand on the shoulders of giants" by learning from their thinking and their code. You also get code that has been battle-tested by many, many developers - tens of thousands in some cases.

As for who is using frameworks... In both the CFML community and the Java community, the percentage is about the same: somewhere between 10% and 15% based on download numbers that I've been able to ascertain.
# Posted By Sean Corfield | 7/14/08 6:16 PM
Alfio Raymond's Gravatar My thoughts and experiences with this situation is
1. most of the developers I have worked with during contracts just learn what they need to do coldfusion work and just do the 9-5 thing where as with me I am trying to get in the habit of coding using oop. I just have to read more into it and try my hardest to stick to that coding style.
2. It's very easy to stay in the procedural way of doing things.
3. Most places I've worked they don't want to show you too much since they think you will move on and use the knowledge you have gained to make more money some place else.

But that is just my view and experience over the years.
If you know of any good reference books to assist me in becoming better with OOP, I'd greatly appreciate it.
# Posted By Alfio Raymond | 7/15/08 4:48 AM
fuzie's Gravatar If you could throw together a blog post containing some of your favorite websites/tutorials from among the aforementioned Flex Dev'ers, I would find that incredibly helpful at this juncture in my OO career.

Fortunately, I started out with OO by reading a book I saw on CJ's wishlist awhile back, The Object Oriented Thought Process. It simplified the concepts for me to the point where I was left saying, "What's so hard about this?" In fact, I wondered if I didn't get it at all because it all made perfect sense to me. lol It's not a language-specific book, though it leans toward java examples iirc. I had learned some OO with relation to .NET, and the book used a lot of the same correlations I had heard before. "Taxi Driver Object", "Passenger Object", etc. Was a good read.
# Posted By fuzie | 7/15/08 4:50 AM
Lola LB's Gravatar Alfio makes a really good point as that's exactly the position I was in. Be a coding monkey, do only what the project specs asked for and no more, and no billable time for experimenting with new techniques (got to justify using it for the projects). Consequently, I never really learned the building blocks (CFCs) on the job. Also, some of us programmers come from a non-technical background and it's a real learning curve for us to learn to think in an OOP manner. Stuff like Doug Boude's tutorials really help - I especially appreciate his terminology dictionary - really makes it clear in an approachable manner. But I do think there could be a few more tutorials at the basic level, along with visual representation of the code being demonstrated, for those of us who need to see the code actually working in order to understand how it all works, and which don't assume that we can infer what the speaker thinks we already know.
# Posted By Lola LB | 7/15/08 5:30 AM
Scott Stroz's Gravatar @Rick - If you are sing a framework and someting 'breaks', I would be willing to bet the 'breakage' is caused by something in your code and not in the frameorks code.

I have deployed many applications using a variety of frameworks and to date, I have not had an issues, or breakage, with any of those applications that were not my fault.
# Posted By Scott Stroz | 7/15/08 5:37 AM
Peter Bell's Gravatar I'm not at all surprised to learn that people are struggling to learn OO. Going from competence (in procedural programming) to incompetence (in OO coding) is a frustrating step. It takes a while, and you need to get a good number of concepts and best practices together before you can start to really see the benefits.

However, you'll never progress as a programmer unless you take the step. There are definitely projects for which OO isn't a good fit, but there's no excuse for a professional developer not to be capable of writing good OO code.

One additional challenge in CF is the cost of object instantiation. When you read books like Becks on TDD and see the "Money" class example, it's hard to relate that to CF because creating bunches of value objects within entity objects in the CF world is usually cost prohibitive from a performance standpoint. As such it's hard to create a really fine grained OO model in CF because you always have to have some awareness of the performance implications.

@Sean, I'm surprised by the Java numbers. I don't know many Java devs who *don't* use Spring, HIbernate, etc. I wonder if the number is higher in the Java community or if I'm only hanging around the "right" 10-15% :-)
# Posted By Peter Bell | 7/15/08 5:53 AM
TJ Downes's Gravatar @Sean
Spot on dude

@fuzie
I'll try to get together another post on these resources soon. But you know what a flake I am :) I think the book ActionScript 3.0 Design Patterns is also a very good resource. I have just started reading it, but for noobs it may be a bit too advanced. It requires you to at least have a small amount of OO knowledge. Certainly flexcoders Yahoo group is where I have learned a lot of my knowledge. But yes, I will post some resources for you :)

@Lola
I think you are correct with your thought that many companies don't allow their devs R&D time to learn these concepts. I try to offer 0-15% R&D time to the staff here to ensure we are constantly learning something new to our development process. I think it makes the job more interesting and also provides more value to our clients

@Scott
Hey bro :)

@Peter
I think one excuse for developers not being capable of writing good OO code can be blamed on the employer, as Lola said. But, developers should try to take the time out of their personal schedules to commit 2-5 hours per week into enhancing their capabilities, less you become stagnant and put your career at risk
# Posted By TJ Downes | 7/15/08 9:38 AM
TJ Downes's Gravatar "I try to offer 0-15% R&D time"

should read

"I try to offer 10-15% R&D time"
# Posted By TJ Downes | 7/15/08 9:39 AM
Bradley Moore's Gravatar Blogs I have read talk about picking up multiple tools/methods to do OO CF, which to me is a major turn off.

I need to look at small examples and mimic them. I need to make mistakes and solve problems. I need to understand how things work together and build the pieces up in my mind before looking at more advanced concepts.

I wrote OO Java projects in school, so that comes fairly easy. I am having trouble taking that knowledge and applying it to a CF application.

I have lots of questions, but frankly I'm not sure where to ask them or where to look for help.
# Posted By Bradley Moore | 7/15/08 10:54 AM
Peter Bell's Gravatar @Bradly,

You might want to consider this:
http://www.pbell.com/index.cfm/2008/7/15/The-Simpl...

I've also got to say that one way or another you're going to want to try to find a mentor (or even take a class). It makes all the difference.
# Posted By Peter Bell | 7/15/08 11:03 AM
Steve Bryant's Gravatar TJ,

My answer was a bit long for a comment:
http://www.bryantwebconsulting.com/blog/index.cfm/...
# Posted By Steve Bryant | 7/16/08 7:33 AM
Bob Silverberg's Gravatar Hey TJ, thanks for the kind words about my series. You are correct that I did not set out to write a primer on OO Design or on Transfer. It may be that my posts are more suited to someone who has been working with Transfer for awhile, rather than someone just starting out. Honestly, I don't feel qualified to write the OO primer, and I think there are already enough Transfer primers out there.

I am, however, interested in making my posts as accessible as possible. If you have any suggestions about ways in which I can make things clearer and/or specific questions that you would have liked to have seen addressed, I'd been keen to hear about them.
# Posted By Bob Silverberg | 7/16/08 12:22 PM
BlogCFC 5.8.001 © Ray Camden