Blog

From Coldfusion to Ruby..Sort of.

August 9, 2008

I finally got a small project that allowed me to utilize the Ruby language. It was a simple script to pull information from an Access database, put it in a flat file, and then upload it to an FTP site.

Normally I write jobs like this in Coldfusion. I know it’s better suited to web site development but it’s fast and easy to create little programs like the one I needed. In this case I did not have access to a Coldfusion server so I needed something that could run on it’s own. I chose Ruby for several reasons:

  • Interpreted language – If I need to make a change to the script while its on the server I can do it with Notepad or some other text editor. No need to recompile.
  • Robust and full featured platform – Ruby provides a great API for working with various protocols, files, etc.
  • Eclipse based interactive debugger – Using RDT is an Eclipse plgin for Ruby development. It provide syntax help and an interactive debugger

The first thing I noticed about Ruby is just how easy it is to work with strings. In Coldfusion I’m used to creating strings like this:

<cfset somevar = "#someval# foo foo">

The Ruby syntax is very similar:

somevar = "#{someval} foo foo"

Just like Coldfusion, Ruby makes it extremely easy to work with a wide variety of protocols through native APIs. SMTP, FTP, HTTP are available out of the box and extremely easy to use.

Coldfusion:

<cfhttp url="www.somesite.com/index.html" method="get">

Ruby:

Net::HTTP.get("www.somesite.com","/index.html")

One of Coldfusion’s greatest strengths has always been the community that surrounds it. Ruby is very similar in this respect. There are alot of talented and enthusiastic people working with Ruby. It shows in the number of available code samples and open-source libaries. It required a bit of searching but I found an example or ready made code for every problem I encountered.

That brings me to my one big complaint about Ruby. It was very difficult to find pure Ruby information. So many times I found myself using the “-rails” clause in my searches. Rails has become synonymous with Ruby so it’s not surprising. I’d just like to see more Ruby only information.

This was my first experience with Ruby and I’m pleased with the results. I feel like I have another tool that will allow me to quickly solve problems when Coldfusion is not an option.

0 Comments

Leave Your Comment

Your email address will not be published. Required fields are marked *


about me

An information technology professional with twenty four years experience in systems administration, computer programming, requirements gathering, customer service, and technical support.