by Judith Dinowitz
After a three-year absence from public training, Hal Helms will offer "Real World Object-Oriented Programming"
, an intensive, five-day class geared especially to ColdFusion programmers who have been having problems making the leap to object-oriented (OO) development.
Hal is offering several new training classes. This one, the first, debuted in February 2009. We sat down with Hal and talked with him about the new class, his return to the ColdFusion community after dropping out for three years, and about what real world OO means to the ColdFusion programmer.
Hal explained, "I started this class because I was in a state of despair over the state of object-oriented programming in the ColdFusion community."
He had been getting many extremely agitated emails and calls. He explained that folks would say, for example, "I'm using Fusebox, Transfer, and ColdSpring,"
and then they would add, "I'm entirely buzzword-compliant but I don't know how to write a simple application!"
Hal saw a need for a class that clearly explains OO programming in a real-world context.
Hal saw the need, but had pulled back from active participation in the ColdFusion community in 2006, when he stopped actively blogging until September 2008. Why? "It was the emergence of pseudo-OO, where OO was a buzzword. People started to use frameworks, but didn't know what the framework was doing or how to use OO effectively."
"There's so much information and so much misinformation out there about object orientation. When Ben Nadel, an excellent developer, tried to write a simple application and chronicled the experience on his blog, he got a lot of conflicting advice, and finally gave up. I thought, if someone like Ben, who is so bright, is struggling with this, there's something badly amiss. But for a few years, I sat on the sidelines watching as 'gurus' gave advice full of misinformation that was seldom useful and often downright wrong. I thought, 'I'll just concentrate on building applications for my clients.' "
Hal credits the advice of a good friend for getting him out of withdrawal and back into the blogging scene. "A friend came to me and said that dropping out of the community wasn't fair to the people who needed help. He asked me how I thought developers would sort through the bad advice I believed they were getting. He even had the nerve to suggest I was being selfish! And, you know, I realized he was right."
So Hal began to blog again, but realized that just blogging wasn't enough. He saw that people needed hands-on help to see where and how to use OO techniques.
"People think that they're doing OO, and they're doing the very best job they know to do, but their applications are not maintainable,"
said Hal. "When they ask for help, the gurus will say 'Well, you're not doing real OO.' "
Hal saw this as an example of the logical fallacy known as "No True Scotsman"
. "If I say, 'X will deliver you from every problem that you have', and you try X and it doesn't, then I say, 'You're not doing true X.' It's an impossible situation. Every problem the developer encounters is explained away by a failure to reach this impossible goal. This was what I saw in the ColdFusion world. We were tying developers in knots."
Pulling out more buzzwords is not the answer, said Hal. "I look at it like the whole financial crisis. We have been deeply wrong. We need to examine our foundations. But, instead, we're trying to put more bandaids on it."
Hal has no problem with frameworks – when they're used properly and understood. But people were using frameworks as crutches without understanding them.
"I will be excoriated for saying this, but I don't like Transfer,"
he said as an example. "Only a very bright person could make this mistake: to let the database drive the model. You couldn't find a more non-OO approach. I have enormous respect for Dr. Codd, who came up with the relational model. But databases make great servants and horrible masters. When you're asking the databases to drive the application, you're asking for problems. Databases are great for expressing the properties of entities: data, in other words."
"In the OO world, we don't start with entities, we start with behavior. Then we ask: Now that we know the behavior we want, who should carry out those actions? You get a completely different architecture than if you start with entities composed of data, which leads to an anemic domain model that contains nothing more than structures with getters and setters attached. So, now, we have the worst of both the procedural and OO worlds: added complexity with no gain in expressive power."
Hibernate, Hal said, is a very good framework. "You can start with the database and generate your domain model, or, as I believe you should, you can start with your domain model and generate your database."
He has not looked into S. Isaac Dealey's DataFaucet.
Hal advised people not to get hung up on buzzwords, but instead to examine the code under the hood for a better understanding of how things work. When he created his training classes, he decided not to inundate people with terms like polymorphism. "Until you see it in operation, it means nothing to you. For a proper understanding of OO, don't learn about Mach-II and Model-Glue. If you want to understand the problem of mapping objects to a relational database, map the code yourself."
ColdFusion has undergone great changes in terms of its relationship to OO, Hal said. "I came out of the Smalltalk world. When I got into ColdFusion, I realized that it was a very different world and I accepted it for what it was: OO was out of the picture. Even when CFCs were introduced, they initially had such problems that it was impossible to use them for writing OO applications."
"I am sorry to say that I feel the state of OO in the ColdFusion world is in disrepair. There's a great deal of misinformation being presented as 'best practices'. I lay this at the feet of people who presented themselves as gurus offering help but piled on more and more restrictions."
Hal would not elaborate on this, but did say, "Developers have a great deal of needless guilt that they're not doing OO – that OO is maybe just too hard for them – when OO, properly understood, is really very freeing and helpful."
Most classes teach you pure OO in a theoretical way. Hal's goal with this class was very different. "I wanted to create a class that teaches real world object orientation in real world applications. We're not instantiating hundreds of objects to get addresses and phone numbers... I'm not going to teach you theory alone. I'm going to teach you how I write OO applications, offering insight rather than just information. This is a much more personal class than I've given in the past."
Learning to make pies by reading a cookbook is obviously less effective than watching a skilled cook who's an expert at pie-making, he remarked.
In the February class, Hal said some students were enthusiastic while others were confused, and found that the class didn't quite agree with what they had expected. He said this is par for the course.
"I remember one of the first classes I took... I came from the woodworking world. I was unbelievably confused, and I know how frustrating and how hard it was to being in that state of confusion. Yet years later, as I learned more about OO, the concepts from that first class now had enormous value. But at the time I took the class, I didn't feel I learned anything at all."
"A couple of people said 'Scale the class down; don't give them so much information.' I took the risk that in the short term, they'd be more confused, but in the long term, they would benefit."
In the class, Hal touched on design patterns, event-driven programming, and JavaScript. "When most people in the ColdFusion community think OO, they think of Model-View-Controller (MVC). But in the web world, the request, wait, response model is no longer acceptable. People want their web applications to be more like their desktop applications, and that means using JavaScript. There's no way around that. JavaScript is an incredibly sophisticated and powerful language but it's also incredibly misunderstood. JavaScript is an OO language but it's not class-based. It uses prototype inheritance."
"One misconception is that everything needs to be expressed in objects. So to display something like 400 employees in a list, people think they should instantiate 400 separate objects into an array, then loop over them to get the information. CFCs have improved since they were first introduced, but object creation is still a very expensive undertaking."
"An OO class – a component in ColdFusion – is a datatype like a structure or an array. Yes, it has more behaviors than more static datatypes, but it is a datatype, nonetheless. So, the question is not 'How can I work with all these objects', but rather, 'Am I using the appropriate datatype?' And we already have a datatype that works very nicely for lots of pure data: it's called a recordset, or query."
"This is a mistake that's easy to make. We hear about OO; we hear about languages like Ruby where 'everything is an object' and it's natural to think that everything should be an object. But ColdFusion isn't Ruby any more than it's Java. Giving up something as powerful as a query makes no sense. Use objects when you need their rich capabilities for behavior – not because OO demands it."
"OO excels at creating what engineers like to call 'black boxes'. Black boxes let us hide the implementation of complex behavior behind a simple, easy-to-useapplication programming interface (API). But not everything has complex behavior and an object composed of properties with virtually nothing but getters and setters – well, that's OO in name only."
The point of OO is to ease the complexity of development, Hal said. But he sees people adhere so slavishly to what they've been told are the only legitimate OO practices that they make development much more complex than it needs to be. "That belief that classes are the answer to all problems ultimately breaks down and people think they have to sacrifice 'OO purity'. But that's like saying, 'I tried to put everything into an array, but had to sacrifice 'array purity'. Would that make any sense? Wasn't the real problem that they were trying to use an array where it wasn't appropriate? When people talking about 'OO purity', they're reacting to the needless restrictions and added complexity that accompanies a false understanding of OO – not with OO itself. And that's a shame, because OO can really make our lives as developers easier."
"How did we get the idea,"
Hal asked, "that the principle of 'objects only' is something to be desired? Instead of empowering people, it's disempowering them.Let me go on record as saying that OO can and should be a tremendous help to developers; it shouldn't tie their hands. OO came from the lessons we learned from doing procedural code. Before we had CFCs in the ColdFusion world, Fusebox was trying to mimic some of OO's good ideas. Now that we have CFCs, we've got better tools at our disposal."
The class in February was only the first of several. Besides the Real World OO class, which he is repeating in June, Hal will hold a class on "Ajax OO Application Development", covering event-driven programming in JavaScript and AJAX, in September. "I strongly feel that developers need to get ahead of the curve on event-driven programming. JavaScript is not just for designers who want cool, slide-out menus. The CFAJAXProxy tag allows you to have a JavaScript representation of your CFC. That means that your JavaScript can talk to this other JavaScript object and respond quickly on the client and instead of refreshing the page, you can just get the information you need."
While Hal's May and June classes are already sold out, there are still seats available for the September class. Hal's classes cost $2700, with breakfast and lunch included. In addition, all attendees at a Hal Helms class receive a free PDF subscription to the Fusion Authority Quarterly Update, the premier ColdFusion journal.
Judith Dinowitz is the Master Editor-in-Chief of the House of Fusion magazines and journals, where she enjoys serving up ColdFusion and Flex goodness on a weekly and quarterly basis.