There is something in the ColdFusion world I think that many of us have just blatantly missed as developers, and I’ll tell you about something my eyes have just been opened to.
I’d like to say I have a pretty firm grasp of OO design patterns, (hell, even J2EE design patterns) and I swear by them. I LOVE them. I (foolishly) try to fit everything into an over-simplified (and sometimes anemic) architecture models. I swear by Java and its “enterpriseiness” and take comfort in the mindest that “as long as its enterprise-level, I can do whatever I want”, that old mentality, its easier to take away from…
I. Am. Dead. Wrong. (this isn’t new, though…more on this later).
You may have noticed, that my posts have slowed as of late, and there is a reason for this. Lately, I have been having a bit of a “software renaissance”. I have been questioning every single principle and theory I hold near and dear. Why are service layer models a good idea? What is wrong with anemic domain, really? Are business Objects the right approach? Why do I even *need* remote facades?! Well, my first mental response is, “well, its enterprise, therefore, its awesome and scalable and going to last the test of time”. Obviously, there are far more concrete answers that make more business sense and what not, but thats beside the point. In reality, none of that is true. I can create robust, scalable, non-OO code as well..
Recently, I’ve began to compare and contrast ColdFusion to Ruby on Rails. First, I’d like to debunk a common misconception that CFers have: Rails is NOT just a framework (opinion alert), I would definitely consider rails a development platform (a domain specific language, if you would) built on top of the scripting language, Ruby. I think the analogy of Ruby is to Rails as Java is to ColdFusion is definitely a fair comparison. I sat firmly in the camp that the whole web 2.0 movement (fueled by ruby) was rubbish and chose not to look over the fence to “the enemy”, but recently, needs have shifted and ruby has been placed in front of me and so I have begun to investigate it and am in the process of drawing comparisons between the different strengths and weaknesses displayed in the platforms. Also, its never good to just sit there and dislike something without really getting to know it.
In case my fellow CFers don’t know about Ruby (and Rails), Ruby is a fully object-oriented scripting language that was designed to be all purpose (similar to python’s role in the computer world), Rails was really the revolutionary domain specific language that brought ruby to the web with mainstream acceptance.
Now, right here, I see an interesting parallel, Rails is the DSL for the web built on ruby, and ColdFusion is the DSL for the web built on Java. Rails has many web-project-oriented features that we feast on daily in CF, but there are definitely some surface level comparisons that can be made even still.
First off, Ruby IS Ruby. All the pieces of software that float in the Ruby world are written in itself. So, one could argue, if you understand Ruby and Rails, you probably could write a standalone Ruby app with (almost) no problem. This mentality is quite contrary to ColdFusion; ColdFusion and everything around it is written in Java. Now, there is nothing inherently wrong with this, but one could not assume that if you understand ColdFusion, you could probably write a standalone Java app, FAR from it. Most people aren’t concerned with this because they are using ColdFusion for a reason, to get away from the needless complexities of Java. This also is one of the things that makes the Ruby community great, they can actually contribute to the projects around them (including things like rake). Most run of the mill ColdFusion developers aren’t going to know how to help Mark Drew write CFEclipse, how about writing a simple ant task? Not likely. This really hurts our surrounding technology pool as ColdFusion developers.
So, I began my trek to understand what ruby is all about and why it is so revered in the web space today. Honestly, as I’ve read through my books and dove into projects, I have yet to find something Rails can do that ColdFusion can’t. but what I HAVE found is that we are putting ColdFusion in a box it should not necessarily live within, the world of J2EE designs. What do I mean? We find things in our code that are straight from the world of Java; Remote Facades, Factories, and Gateways, Oh my! Hold on a second, didn’t we move to ColdFusion to GET AWAY from these layers of complexity? I thought I did at least. All we’ve done is built a (less robust) toy chest of tools that complicate a robust, expressive, dynamic language. Its obvious that this would happen because a decent amount of the (advanced) people who care about ColdFusion come from Java/J2EE backgrounds…go figure, right? :)
Sean Corfield recently was the first to admit this mentality, He found himself trying to fit ColdFusion into this box and discovered how much we are limiting ourselves with this sort of mentality. Java is (obviously) not a dynamic language, its very much a static and compiled language that does not lend itself to the sort of flexibility you find in languages like Ruby and ColdFusion. So think about it this way, Interfaces aren’t used to dynamic, runtime functionality, factories didn’t originally account for the wonders of typeless environments (read duck typing), etc. These constructs were design with a set of constraints placed upon them, and in ColdFusion we are CREATING these constraints on top of a language that never had them in the first place. WTF?!
Now, of course, who is to say we can’t improvise on factories and make them a bit more flexible and powerful based on our dynamic freedoms, but then I start asking myself, what is this really doing for me now? A lot of the time, I considered relying on things like services layers thinking that I would be able to “account for things I can’t see” in the future. Rails developers are quite different, they develop only what iss needed, and grow and grow as the complexity needs arise. This is of course, a rather obvious approach (again not Rails-specific, just a trend), but often times, I find myself mapping out parts of my code that does not need to be mapped out yet and will lead to the inevitable refactoring nightmare.
Ponder this, should we EVER be able to refactor ColdFusion? Is that a benefit? and if it is, why? Is refactoring in a dynamic language something we should even be considering?
I think that this is one of the reasons we get stupid people coming around saying “Cold Fusion? Isn’t that language dead!?” is because foundationally, we are the same animal we were 11 years ago. Revolutionary at the time, but in 11 years, we have seen a lot of powerful technologies come our way that solve problems differently, and in another 11 who knows if we will even still be talking about ColdFusion, or Rails, or Django, or whatever. Also, maybe its the difference in mindsets that rails and CF people have; The average CFer doesn’t really know what (or use) the dynamic powers of CF, for instance.
Regardless of my decision for ColdFusion or Rails in my future projects, I have definitely had a paradigm shift in the way I think about my code in dynamic languages.
Interesting post, but I still think you’re views on software design are still a bit naive. That’s not a slight in the least as I can strongly relate to your sentiments and remember that phase of thought earlier in my career.
“Most run of the mill ColdFusion developers aren’t going to know how to help Mark Drew write CFEclipse”. I think that’s an unfair stereotype. Almost as unfair, but not nearly as true in saying that a “Ruby developer couldn’t code their way out of a command prompt”, or “Ruby can scale”. When in fact it’s the Rails streams that power that river of faults.
Derek, I think you left ColdFusion at exactly the wrong moment, because we are going through a bit of a renaissance. In as recent as 3 months we’ve seen two major open source CFML engines emerge. I’m extremely excited about JBoss’s recent adoption of CFML on JBoss.org. JBoss wanted to adopt a dyanmic scripting language and overlooked Groovy and JRuby for CFML. There is something to be said for a scripting language that continues to grow nearly 15 years after it’s inception. From 2007 to 2008 the ColdFusion community grew by ~15%. That’s quite impressive for a ‘dying’ language (while the same reports are saying that Ruby has leveled off and expecting to decline).
The other aspect of the CF community people should recognize is that we are the original pioneers of the internet. Back in the day, it was CF or CGI (pre-dating ASP, JSP, PHP, etc). The average ColdFusion developer has been using the language for over a decade. To give credit where credit is due, I don’t think there has been a compelling reason to look elsewhere until recently with Ruby and Groovy.
Anyway. I know whats being planned for CF9 and JBoss/Railo have got some great plans as well. I think we’re going to give your command prompt a run for it’s money. What I <3 about CFML is that I can choose to use design patterns, OO or procedural and anything in Java. That toy chest means I can use the right tool for the job, which is why I’ve never felt limited by ColdFusion.
@Adrock,
You bring up a lot of valid arguments, for sure. But I still do feel that in comparison to some of the flexibilities that are capable in other dynamic languages such as Ruby, and even Groovy (which I also think is awesome). Its really hard to articulate exactly what is great about them. I always laugh at this, because a lot of Ruby developers feel the same way, hell, even the lead developer on the project says “he likes the way it feels” when he codes in Ruby, and I have to agree, its a feeling, a convention that just makes sense to me now.
In reality, its not like I have some vendetta against ColdFusion, I just feel that it became niche in a lot of ways (at the time) that I thought was not fair to itself.
At the end of the day, my argument is against boxing dynamic languages into static paradigms, thats something that you see constantly in ColdFusion, and there is no doubt about that, I hope that ColdFusion 9 opens up a world of more dynamic power to allow developers to shy away from the “old guard” of methodologies that just become unnecessary in most cases.
Also, do keep in mind this was a post I back-ported from my old blog from over a year ago, a lot of my mindsets have shifted from then and now.
Conceptually you have an interesting point in that patterns that have static language limitations has a force may not lend themselves well to dynamic languages (using your terms).
What would also be interesting is exploring and identifying successful patterns that are in play with dynamic languages that don’t apply to static languages.