ColdFusion and OOP - Match Made in Heaven, or Long Road to Hell?

Hal Helms, Ben Nadel and I recorded a conversation over the weekend on the subject of OO in CF. I'm supporting the position that OO is still a good thing in CF, Hal disagrees, and Ben is undecided. As you might expect, Hal is left a trembling husk as the weight of my arguments unmercifully crushes him. You know those scenes in superhero movies where someone gets punched so hard they end up in a crater in the ground? It's like that. Only worse.

In all seriousness though, it was a very fun talk and I think there are some solid points made from all involved, but I'll let you, gentle reader, be the judge. You can download the recording here.

In the interest of keeping any discussion on this topic from fragmenting, we've decided to disable comments on our respective blog entries and instead created a Google Group to act as a central sounding board. Hopefully this isn't too inconvenient, I realize it's something of a departure from the norm, but let's see how that works.

I'm not sure yet whether this will turn into any kind of regular discussion, but I suppose it could. We'll just have to see what folks think! Thanks.

del.ico.us del.icio.us | Digg It! Digg It! | Linking Blogs Linking Blogs | 2131 Views

HTML 5 Isn't Going to Kill Flash

Lately I've seen a number of blog posts and news stories touting HTML 5 as some sort of Flash Killer in the RIA space. Am I the only one shaking my head at this?

First off, let me say I'm thrilled that HTML 5 is in the works, and that the markup language is being improved. I could say it's about time, but I won't. (I guess I just did though!)

That said, the people claiming that HTML 5 is going to kill Flash seem to have a pretty poor memory. According to the editor of HTML 5, it's not going to become a proposed recommendation until 2022. That's over a decade, folks. That's a long, looooong time.

Think back a decade. Remember 1999? Most people were using IE 4. There was no AJAX, and there were no RIAs. There were no social networks. There was no Twitter, and no iPhone. Now project that kind of change forward 10 years, only double the rate of change. So much is going to happen before HTML 5 is widely adopted that it's not even funny. Heck, something might even kill Flash. But it's not going to be HTML 5.

And even if the new spec offers some kind of parity with Flash, Flex, and Silverlight, it's not like the existing RIA platforms are going to stand still. There will be huge advances over the next decade. So being, among other things, a Flex developer, I'm probably biased here. But I just don't see what all the fuss is about. An updated spec is great, and I sure it will find many uses and offer a lot of interesting features. But to trot this out as yet another Flash Killer seems unrealistic at best, and reeks of ulterior motives at worst. What do you think? Am I right? Or am I just blinded by my association with Flex?

Comments Comments (12) | del.ico.us del.icio.us | Digg It! Digg It! | Linking Blogs Linking Blogs | 1972 Views

OO Can't Ruin Businesses, but People Can

Blogging newcomer Marc Funaro made a provocative first post over the weekend with his entry How OO Almost Destroyed My Business. It has gotten a lot of comments, some supporting him, and some taking issue with his conclusions. I started to comment but decided it would be better to generate a secondary discussion rather than add onto the already long thread.

Marc says he picked up ColdFusion as a non-programmer, and had good success with it until fairly recently. With the movement toward object-oriented development that is happening in the ColdFusion world, he ran into trouble. He read some books, some blogs, and took a class on Java development. And he ended up overwhelming himself with unnecessary complexity in terms of frameworks, design patterns, and OO architecture. He sums up the result of doing this pretty nicely:

"The bottom line is, when you NEED to use some OO concept, YOU'LL KNOW. *That's* the time to start writing OO-style code, and only then... not everywhere else."

Which is pretty good advice. It's something that any knowledgeable proponent of OO will tell you. I'm sorry that it took him a good amount of time and frustration to reach that conclusion, but I'm glad he finally did.

Where he goes wrong, though, starts right in the title of his entry. OO can't ruin anything, but people making bad decisions absolutely can. And what Marc did was make some bad decisions, because he was new to OO, confused, and, as he says, "downloading one framework after another, piling them all into an application". This is like reading a book on construction, and then going out and trying to build the Taj Mahal when all that was needed was a garage.

Bad decisions don't mean a person is stupid or foolish. Smart people make bad decisions all the time (I'm not conceited enough to call myself a smart person, but I definitely have made some bad decisions). Usually, it's simply a lack of knowledge or experience, or a failure to understand the implications of the choices you're making. But even that is OK, because when someone makes a bad decision, it can still have a positive outcome if it results in learning something. OO does not equate to using a framework, and it does not require the application of every design pattern under the sun. It's simply a way to organize code, manage complexity, and accommodate change. Sometimes, that is best served by using a framework like ColdSpring or Spring. Sometimes, design patterns can offer solutions to encapsulate variations in a system and cope with change. One of the key things anyone using OO must understand is that there are pros and cons to every decision, and multiple solutions to a given problem. The only way to learn how to assess these trade offs is through experience.

The reality is that a lot of ColdFusion applications don't require a massive OO system to power them. Many of the small- or medium-sized applications don't need an n-tier architecture loaded with abstractions and design patterns. But that doesn't mean that some of the good ideas of OO, like encapsulation, can't be used with big benefits. One doesn't need to turn every query into an array of objects. Just creating well-defined interfaces to expose behavior to the rest of an application will get you a long way. Once something is encapsulated, it's much easier to change it later if you need to. It might be just a few CFCs to wrap up the bulk of the logic and hide the implementation. That might be all that will ever be needed. But if (and, more likely, when) things get more complex and it comes time to start adopting a broader set of OO principles, you'll be in a much better position to do so.

However, there is another reality that can't be denied: in the debate between procedural and OO development, OO has won. It won many years ago. ColdFusion is one of the few languages left that supports procedural development to a large degree. If you want to keep being a software developer, or ever want to move to a language like ActionScript, C#, Java, Groovy, or Ruby, you're going to have to know OO. That's just how it is. And as Marc points out, even within the CF world, OO is taking over, and the number of jobs available to people without OO experience are going to keep getting smaller and smaller. Some folks may not like this and may attempt to rebel against the trend, but you can't stop the tide. OO is not going away, in fact, it's only going to get ever more ubiquitous. So it's probably in your best interest to learn about it. One doesn't have to use it on every project, nor does one have to use it to create a complex, over-engineered mess. But experience is the best teacher, both in terms of learning OO and increasing your demand in the marketplace.

So, with respect to Marc, don't do what he did. Don't try to swallow the entire OO buffet in one bite. If you try, you'll fail. You'll get frustrated. And in that red haze, you'll probably miss the simple benefits of OO. Instead, learn what you can and take time to digest the information. Experiment with it, but don't get carried away. Apply what makes sense to you where you can, in small bits. Remember that the goal is to learn, but it is also to help you do what works for you and build applications that satisfy customers.

I suppose the bottom line is: Don't be afraid of OO. Be afraid of anyone who says that OO is the only way to build an application, and be just as afraid of anyone who blasts OO because they got carried away with it and got burned.

Comments Comments (23) | del.ico.us del.icio.us | Digg It! Digg It! | Linking Blogs Linking Blogs | 3028 Views

SilverFlash Beta Released: A Joint RIA Platform from Adobe and Microsoft?!

Microsoft and Adobe just announced the public availability of a joint RIA platform called SilverFlash. While it is only in early beta, and the future plans are somewhat vague, this looks like it could be something quite interesting for Flash and Flex developers for several reasons.

First, it actually goes far beyond Microsoft's current Silverlight platform, in that it actually merges the Flash platform with the Windows Presentation Foundation (WPF). In some ways this seems similar to what Adobe AIR provides, except that the WPF extends much more deeply into the Windows operating system. That means a lot more power when doing desktop integration.

But obviously the real draw here is that we'll have a unified RIA platform that is backed by all the major players in the industry (even Sun is on board) and that runs on any operating system. Just imagine: the power and ubiquity of Flash combined with the stunning calendar widgets of Sliverlight, all wrapped in a Java applet. You can download the beta at the SilverFlash Launch website. This is going to do for RIAs what the Apple Newton did for handheld computing!

Comments Comments (4) | del.ico.us del.icio.us | Digg It! Digg It! | Linking Blogs Linking Blogs | 2342 Views

Is the ColdFusion Community's Generosity Encouraging Laziness?

I've been using ColdFusion for a long time. When I started back in late 1997, I was a very novice programmer. There wasn't much in the way of mailing lists, online forums, or books. There was no Google, and there were no blogs. As a result, I developed what I'd consider a pretty self-reliant nature on the subject of programming. I had to read the documentation, experiment, and try things out. And doing this, I was able to solve my problems.

I am a member of a number of public discussion forums and mailing lists, and have been for many years. I moderate several forums and lists. Over the years, I've tried to help others by answering questions or pointing them in the right direction to solve their problems. I'd like to hope that I've helped save some people some of the pain and time that I had to go through when I was learning ColdFusion.

Lately I've been seeing a disturbing trend: a rapidly increasing number of what I will call "lazy questioners". Sure, some of these folks have always been around. But in the last six to twelve months it seems like the number of these people has been making a rapid upturn.

On the one hand, this might be good news: it seems to indicate that more new people are coming into the community. I think that's great. However, what I don't think is great is their approach to asking questions.

If you are also a member of one or more forums or mailing lists, have you also noticed the increasing number of questions like these?

  • How do I invoke a trigger from ColdFusion?
  • Why doesn't this work: <cfif IsDefined("#url.id#")>...
  • Why does my if block always run: <cfparam name="url.id" default="0" /> <cfif IsDefined('url.id')>...
  • How do I zip something in ColdFusion?
  • What is wrong with my query? [paste SQL]
  • This doesn't work please help me. [paste 300 lines of code]
  • Why doesn't this work? #XMLParse( [string with invalid xml characters in it] )#
  • Will this work? [paste code]

The list really goes on and on, these are just a few of the ones I recall seeing recently. If you're asking yourself "what's wrong with those questions?", I'll tell you: either they're horribly presented questions or they could be solved in 30 seconds just by doing a Google search or actually looking at the documentation.

So what's the problem? The next response is probably "just ignore the question if you don't have anything nice to say." That's a valid response. And it would work, provided that everyone else also followed it. But they don't. When questions like these come up (daily at this point), at least one good-natured person decides to try and help. They politely provide a useful answer. Which is admirable. I often do this myself. But after thinking about the overall situation, I've come to the conclusion that it's actually a harmful choice. Here are some of the reasons why:

First, all this does is encourage the questioner's laziness. In fact, it encourages laziness for anyone asking a question. Why would someone bother to find an answer on their own when they see they can just ask someone else and know they'll get an answer?

It also means the person probably hasn't really learned much. They certainly haven't learned how to find the solution to a similar problem when (not if) they encounter one. The old adage "Give a man a fish, feed him for a day. Teach a man to fish, feed him for a lifetime." has never been more applicable. Answering a lazy question almost guarantees more lazy questions in the future. The questioner is banking on the generosity of others, and allowing them to shift the time and effort onto a bunch of other people. And, unfortunately, it works.

Which leads directly into the next negative result, which is an overall decrease in the usefulness of the list or forum. Lazy questions decrease the signal to noise ratio of a resource. They take time and attention away from valid and well presented questions. And it's not just the initial answer. Often, when a lazy question is answered, it triggers a long exchange where the questioner says "that still doesn't work" or "what about this variation". In response, the kind folks answering keep feeding into it, many times offering additional information that the questioner would have discovered themselves if they had put even minimal effort into solving their problem through Google or the documentation.

In essence, I think the ColdFusion community is too forgiving of lazy questions. I might get flak for saying this, but it's true: we're too nice when it comes to this issue.

Now to be clear, I'm not saying we should be mean, or that we should stop answering questions. We should absolutely keep answering questions. I certainly will keep trying to help people. But anyone asking a question should understand that there is a certain minimum level of effort that should be met before you ask. To me, the minimum level of effort is:

  • Have you actually tried to run the code? What was the result?
  • If there is an error, be able to provide the exact error to the best of your ability
  • Have you read the documentation?
  • Have you searched Google?
  • Have you searched the past threads/messages?
  • If the problem is SQL-related, have you run the query directly against the database, outside of CF?
  • If you plan to paste code, have you eliminated all extraneous code and limited the code to only what is involved in the problem?
  • Have you attempted minimal debugging with cfdump, cfabort, or cftrace?

This is not a lot to ask. In fact, this should be done out of common sense and common courtesy. If someone chooses not to meet this minimum level of effort, they should be met with a terse, blunt response, and NOT the answer to their question. There is a much more general and lengthy resource on this subject at the Smart Questions FAQ.

Here are a few situations where I say the questioner's laziness should be called out:

  • The answer could be found by simply reading the documentation on the tag or function, and it is obvious that they have not
  • The answer could be found with a 30 second Google search
  • The questioner is asking an advanced question on a complex subject when it is clear they have limited understanding of the subject or what they're even asking about, and they're expecting a free class on the subject (i.e. "I don't know much SQL, but how do I write this complicated query")
  • The questioner is asking if something will work when they haven't even tried to run it
  • The questioner is asking others to write their code for them
  • The questioner is pasting huge amounts of code and expecting others to sift through it

In many other communities, lazy questions are met with harsh responses that range from "RTFM" to "JFGI" to derisive abuse. I'm not asking the community to go down that road. I love the fact that for the most part, the CF community is a very open and encouraging place. I just think that a small but growning number of people are taking advantage of that generous spirit. It's time to impose some minimal expectations on those who would ask for our time and assistance.

I'm expecting this to trigger some interesting feedback (hopefully nothing too rough, but if you disagree and can point out some flaw with my logic here, by all means go for it). What do folks think about this issue, and what is the best way to deal with it?

Comments Comments (18) | del.ico.us del.icio.us | Digg It! Digg It! | Linking Blogs Linking Blogs | 2235 Views

Previous Entries / More Entries