Wednesday, July 20, 2005

ERB (Ruby)

So I have this templating program that provides support for queries and the like to product MHTML files (for Word, Excel, etc, just so I don't have to mess with Office Interop).

I rewrote it in Ruby today, using the built-in templating engine ERB over the c# version's NVelocity. Cut the amount of code in half, and ERB is a lot more flexible.

Ruby is good stuff. You might hear it called "hype", but there's a reason so many very smart people are excited about it. It's just damn cool, it's elegant in a way few languages are, it's support libraries are amazingly mature for such a "young" language (a lot more complete than .Net's when it comes to templating for just one example), and it just helps you keep what should be simple tasks simple. Why should I worry about great design with this templating program for example? In Ruby I just whip up a couple helpers, instantiate them in the current context, and toss in a couple lines to open and execute the template.

$stdout << %Q{Ruby is fun!}
Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?