Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby off the rails

Tags:

ruby

One of the huge benefits of Ruby is the ability to create DSLs very easily. Ruby allows you to create "business rules" in a natural language way that is usually easy enough for a business analyst to use. Many Ruby apps outside of web development exist for this purpose.

I highly recommend Googling "ruby dsl" for some excellent reading, but I would like to leave you with one post in particular. Russ Olsen wrote a two part blog post on DSLs. I saw him give a presentation on DSLs and it was very good. I highly recommend reading these posts.

I also found this excellent presentation on Ruby DSLs by Obie Fernandez. Highly recommended reading!


I use Ruby extensively in my work, and none of it is Rails (or even web) based.

My domain is usually client-side Windows applications (wxRuby GUI) and scripts, automating Excel, Internet Explorer, SQL Server queries and report generation (win32ole COM automation). I also use the sqlite, pdf-writer, and gruff libraries for various data munging and graph generation tasks.

Rails' success has been great for Ruby, but I agree that Rails has received so much attention that Ruby's value beyond the web is often overlooked.


We are mainly a C++ shop, but we've found several areas where Ruby has proven quite useful. Here are a few:

  • Code Generation - Built several DSLs to generate C++/Java/C# code from single input files
  • Build Support
    • scripts to generate Makefiles for unix from Visual Studio Project Files
    • scripts for building projects and formatting the output for Cruise Control
    • scripts for running our unit tests and formatting the output for Cruise Control
    • scripts for manipulating Visual Studio projects and solutions from the command line
  • Integration Tests - We can crank out tests much quicker and cleaner using Ruby than C++
  • QA's entire testing suite is written in Ruby

Ruby is basically my go to tool for where it makes sense. And it makes sense in a lot of places.


Google Sketchup uses Ruby as an embedded scripting language. You can use it to perform all sorts of 3d modeling and import/export tasks. The scripting works with the free version and there's even decent documentation.


Ruby with a homebrew extension written in C++ does all the heavy pixel pushing for my photography processing. I was using Python+numpy but when doing artsy stuff, Ruby is just more fun. Also the relative lack of, or lesser maturity of, good image processing libraries makes me feel less like i'm reinventing wheels. I am clueless about Rails, other than i've heard of it, have a fuzzy idea what it is, and actually have a book on it (unopened)