CF on Rails
By Pete Freitag
I have noticed two CFML developers have made the switch to Ruby On Rails (a Rapid Web Application Development Framework for the Ruby programming language).
Michael Buffington was the first CF developer I noticed make the switch:
I took a perfectly good (arguably) ColdFusion application and rebuilt it from the ground up in Ruby on Rails. My goal was to match features exactly, but I couldn't help but toss in some subtle Ajax improvements as well as clean up all the URLs for the app (more after the jump).
I'm super pleased with the outcome, and the entire process of the rebuild.
Building a Rails app for me was very satisfying. I had just started becoming comfortable with Ruby, and once I actually planned out the wordPhoto.org rebuild, it really became fun. The leaps and bounds you can make quickly with Rails is truly amazing. I'm used to rapid application building with ColdFusion, but Rails is more rapid, which was a surprise.
I should point out that Michael is no CF newbie, he has been working with it for years, and has even given some talks at conferences on ColdFusion.
Greg at SocialTwister has moved to rails, and writes:
For my fellow CFers out there, I'll simply say that I still love CF, but Rails Rocks. My CF code was written very similar to the way Rails works now so it made a lot of sense.
So can we build a framework as cool as ruby on rails for coldfusion?
I tend to think so, CFML has been the king of RAD web development for the past 10 years. CFML is a language that was designed for rapid development. Ruby on Rails is a framework for the Ruby programming language. I would think having a good framework for RAD development in CFML would be able to beat RAD development in Ruby any day. But perhaps I'm just biased?
You can't really blame Michael, or Greg for switching - they just want to turn their ideas into apps quickly. CF is great for that, but they have found Ruby on Rails to be faster and easier for their needs. I'm sure if they had a framework for CFML that did what rails can do, they would be looking at it.
CF on Rails was first published on July 24, 2005.
If you like reading about ruby, rails, rubyonrails, coldfusion, or frameworks then you might also like:
The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.
CFBreak
The weekly newsletter for the CFML Community
Comments
One other reason I haven't posted about it is because I need to check out the Churvis' PLUM, which looks good on paper, though I wouldn't say it's necessarily something which directly correlates to RoR.
Being a Python hack, I've also been looking at Django which was very recently released and looks promising as well.
So many frameworks/languages/cool stuff, so little time... :)
ColdFusion HAS some very nice frameworks that enhance productivity. However, the one thing that seems to come out in any rails conversation is the abstraction of database calls. I've only looked at RonR briefly but it seems that they've got a very slick way of automating getter and setter functions with the DB. It requires a rigid naming convention on the db side in order for the script to find it but it seems that taking care of that plumbing is a big hit for many people.
Another feature that draws ooos and awes is the built in AJAX features. They've implemented some standard AJAX library stuff that developers call from code and it just works. I'd like to see some of this with CF but Flash Forms are 'supposed' to be our RIA platform of choice. ;)
Anyway - what other things does Rails do that we currently aren't getting from our frameworks?
http://www.productivityenhancement.com/News.cfm?id=PlumV10Released
If PLUM isn't RAD, nothing is.
Mark Fuqua
But from a technical standpoint, there's really no comparision between (Ruby|Python) and CF. Having a bit of commercial CF experience myself, I would claim that 70% of the stuff you can only do using components and nasty UDFs in CF, are natively available in (Ruby|Python) *or* can be written in 3 lines of very concise and *readable* code. Plus, of course, there's the obvious advantage of free, open-source software, with a community as strong or as helpful as that of CF.
Also worth checking out Django (djangoproject.com), from the Python guys. Too bad it took the Python community so long to come up with something as good as Rails. I still like Python a lot but right now I've got way too many lines of working Ruby code to switch back :)
I actually was talking to Michael when out in Portland a week ago. We were both pondering about a CF version of Rails as well.
One part of the appeal is the discovery of the database that occurs. I think that this can be done with relative ease although it's not as direct. I've seen some projects that will let you get access to SQL Server and Oracle, but they rely on polling several sys tables. Rails does indeed make use of some relatively strict rules although they can indeed be overwritten.
Another thing that comes "for free" are cleaner, nicer looking URLs.
A third thing I was really interested in is the ActiveMailer which handles all sorts of mail items. Previously, I used iMS Mail Server with CF and while I had control to do all I wanted, it was an expensive route with licensing CF, iMS, and SQL Server.
And that's one of the major points.. licensing. Indeed there's so little to consider. My $7.95 a month account does wonders. We were already running Linux for our mail server and this made it quicker.
I'll compare this to the sometimes painful process I was going through developing DAOs, Gateways, Beans, Controllers and the like. I know I wasn't using a published framework, but even if I was using Fusebox or anything else it would still take a lot longer.
And for background, I've been doing CF for 8 years now. I've taught classes on the matter and made the majority of my income in that time as a CF consultant - so I've been on the CF bus for quite some time and have no problems with CF at all.
So in summary.. Rails is really cool. I would love to see CF on Rails and I think it's very viable. I think a MSSQL tie in would be quite interesting since Rails -> MSSQL seems to only work well when on a Windows box (some driver related thing).
I think the CF community could use something like this to generate a nice bunch of interest from new people.
One of the great benefits of Rails is that you can build a functioning app using helper scripts that write the OO code you need to wrap around the database, as well as the CRUD pages for getting info into the tables. So with 2 or 3 script calls you've got a fully functioning (albeit very bare-bones) web app. You can't get more rapid than that! Duplicating this functionality was the next step in my project.
The problem now becomes writing millions of functions that do everything for you! I've run into a few deadends ... you can't really use custom tags the <cfimport> way because you aren't allowed to use variable names in the taglib= attribute, so I'm using CFCs for just about everything.
I'll have to start that project up again now that I see there might actually be some interest ...
I have some code written that uses the JDBC API get database meta data. Though its not totally done. I could contribute that to the project.
It seems that in the CF world everyone is arguing my framework is better than your framework while the earth is moving beneath their feet.
If the Python, PHP and dotNet communities are building versions of rails, why not CF'ers? I don't mean tacked onto another framework but a ground up port.
Count me in as one willing to help. It has to be a community effort to succeed.
I do know of one effort however to replicate active record and that will be a great step forward.
If we want to attract new people to CF we need to not lose the rapid application development lead.
http://coal.ryanguill.com