ColdFusion meet Ruby on Rails

by @jehiah on 2005-08-09 00:57UTC
Filed under: All , ColdFusion , Articles , Ruby , Rails

I may make the third ColdFusion developer to begin switching to Ruby on Rails behind Michael Buffington and Greg Narain.. but why?

I am certainly no stranger to programming - especially web development - it has been my bread and butter for numerous years. If you are curious why I am going to continue using ruby, read on, but I don’t think anyone should criticize rails without having developed in it.

The probjects I have done in Java have been a pain. I never liked the language much as it always seemed to be fighting against me. I might just hate explicitly compiling, or it could be the nature of a static typed language. I attempted to write a Java version of the memcached deamond, and did actually get parts of my code working; but I was never able to get it stable or fully working. [1] Java may be good for some crazy complex things but I havn’t found them yet, and Java is clearly not designed for web stuff. (Though it does seem to be a good middle layer language for ColdFusion to be written in.)

Steady readers will know that am now doing web development in Python for various reasons. I have been happy with the language as far as a language is concerned, and especially happy with zope page templates, and how form validation is done therein. It also seems to be a good language to work on in a team setting.

Before I get to what I like about Ruby, I’ll cover what has kept me in love of ColdFusion for many years. Pete Freitag puts it this way :

… CFML has been the king of RAD web development for the past 10 years. CFML is a language that was designed for rapid development.

He is right. ColdFusion was designed for web development and it shows. It shows clearly for me in how webservices are dealt with. The seamless integration of components and webservices was simply brilliant. Alot of other things are great in CF as well. I love mixing functional tags in with my html tags. Easy readability is a plus!!

The libraries and functions are good, and It really shines as a application for making web interfaces to existing [legacy] corprate applications by just sneaking in through the database. You don’t have to do much to get data back from the database in coldfusion, yet it is flexible enough to let you do any of a million crazy things to match up with other systems.

Those types of tasks are all enjoyable. What shows the weakness of the language is the things that a programmer (myself in this case) finds tedious. I hate creating the “simple form” type apps where It is just your standard add/edit/delete/list operations on a single table or two. These apps make you feel like a human cookie cutter.[2]

Cue Ruby from stage left

There are many advantages to the language Ruby itself. It is crazy flexible, and allows you to make additions to the language itself. (yes I know thats an odd programming concept). Jim Weirich gave an awesome talk at OSCON05 titled 10 things every java programmer should know about ruby. He clearly outlined some of the ways Ruby challenges us to think about programming, and illustrated wonderfully how it increases our ability to express programs through that language. Every example he gave (yes they were real examples) blew away the java code in simplicity and clarity of implementation.

Cue Ruby on Rails from stage right

Ruby on Rails has gotten some huge buzz recently, but it’s for good reason. Ruby on Rails makes the simple things (which require extra steps in CF) simpler than you could have imagined.

In ColdFusion you generally do the following things to setup a simple Add/Edit/Delete/List type app on one ore two tables : 1) Create database table(s) 2) Create an Add form, 3) do serverside validation, 4) write sql to insert into database 5) create list page 6) create search page 7) create search sql 8) create edit page 9) create update sql 10) create delete sql

Those are the steps. yes all 10 of them. What’s hard to realize though is that almost 90% of the work is just plugging in the field names into the database. Users hate it, and rightfully so, when they have to re-enter data more than once, it’s about time programmers start thinking the same way.

In Ruby on Rails all the add/edit/delete/list pages are generated by your the columns in your database. Wow isn’t that nice. Yes the framework dictates database design, and you might end up with long column names, but they are gauranteed to be descriptive. Note that this is also exactly why Ruby on Rails will never work for many of the things people do in ColdFusion :sometimes you can’t dictate the database structure. But when you can ColdFusion has a ways to go in automagically doing the rest.

The following steps are what you need to do in Ruby On Rails: 1) Create database table(s), 2) Generate scaffolding - more on that later 3) Generate search form.

Thats it, you don’t have to create sql statements for all the simple stuff, and you don’t have to create the forms (Assuming you actually use descriptive column names. Forget abbreviations, just use the real name)

Cookie cutter no more, Ruby on Rails to the rescue

So what is that scaffolding stuff? Scaffolding is just the part of Ruby on Rails which does the cookie cutting for you.

Not that rails isn’t without it’s quirks or problems or difficulties in learning curve. It has those, but now I can actually enjoy writing simple applications because of what the application does, not dread what I need to do to get it working.


1 : Should you care to fix/finish my java memcached app, drop me a line

2 : ColdFusion frameworks like fusebox may help. (that is what I’m actually advocating) I really don’t have any experience with the frameworks that exist with coldfusion. I acknowledge this and hopefully will be able to rectify this.

Subscribe via RSS ı Email
© 2023 - Jehiah Czebotar