What makes Ruby/Rails Development Fun

I have been a full-time Ruby programmer for about a year now. I used ruby/rails before then but I didn't really "get it". Considering that I was a Java/J2EE guy before and never worked with dynamic languages, it wasn't surprising. Now that it has been a transformation and a worthy evolution, it is about time to review what makes ruby development fun. Yes, Ruby is known for its dynamism, expressiveness, malleability. But today I hope to list a few tools, techniques, concepts that make my programming experience fun these days. Here they are:

Ruby-Generators:

While code-generation is not new to any language, what differentiates ruby's code-generation is its language support, installation and user-specific generators. What I mean is when a gem called "rails" is installed, it comes with a generator to generate an app. When you are inside a rails app, we can use script/generate to generate various web artifacts. If you need to write a generator just for yourself, you can create generators in your home directory under ~/.rails/generators/ folder and it will be available to you inside your rails app. Generators are not limited to rails app. Any gem you write can have a generator in it, just like the "rails" gem.

Gems:

Just another name for reusable code or libraries. Again nothing new. What differentiates rubygems from library support in other languages is the dependency support and easy of install/uninstall. Gem dependency management is similar to Java's Ant/Maven support for dependencies, however, in Java, it came after years of painful experience only recently. In addition, you need to learn whole new xml language for Ant or maven dependency definition. With Ruby, everything is ruby, be it database migrations, build-tool Rake's rakefile, or deployment-tool Capistrano's Capfile.

Ruby as scripting language:

Before ruby, I had shell-scripting or plain simple DOS commands at my disposal to perform daily chores. While shell-scripts did save the day, it wasn't flexible and expressive enough. Perl could be equally powerful but I am not too familiar with it. If you don't have a good scripting language in your tool-box, you owe it to learn ruby. I am guessing that since Ruby was written with inspiration from perl and other great languages, it must have benefits over perl.

Database migration support:

With J2EE or .NET, you need a separate set of tools to deal with SQL, execute SQL and rollback or move-forward with a database change. With rails, it is all built in. You don't even have to write SQL, just writing Ruby code to get most things done. SQL is not out of reach when you need it. Convention over configuration as it applied to table names and column mapping go a long way in reducing the programming overhead.

IRB and script/console:

script/console is a great way to probe your environments manually. It loads the entire application environment and allows user to execute any ruby code from command line. This is especially useful in probing your database without writing comple SQL statements. Interactive Ruby shell (IRB) allows you to load base ruby language environment and execute commands, which is immensely helpful as a quick reference and learning basics of ruby language.

Deployment support:

While comparable to Ant and Maven for deployment, ruby's deployment support goes a few steps further. Gems like capistrano automate deployment on multiple servers for multiple environments. The support for automated ssh logins on remote servers is great in automating preety much the entire deployment process. I am guessing, all of this is doable in Java or .NET or any other language but doing it in ruby is especially easier given its scripting nature and small runtime size. Such support is either still missing in other languages or is too little too late for me. Besides capistrano, there are alternatives for deployment tools like Puppet, Sprinkle etc.

Git and Github integration:

Most, if not all, people agree that git is the best version control system out there. While this in on itself not an advantage of ruby/rails, it hasn't caught up with Java or .NET community as of yet. I guess, most projects on github are either ruby or C. Rails framework moved to github almost a year ago. Github integration as gem source (http://gems.github.com) makes it very easy to share code, making it easier for individual developers to publish their codebase. Forking facility allows for easier branch management. Github is almost a social-networking platform for geeks.

Tutorials and community support:

Just like Java API or .NET MSDN website, Ruby an API site or two. Those are not great but do the job. What makes it easier to learn new libraries and language in general it things like Railscasts, EnvyCasts, Peepcode. A picture is worth a 1000 words and a how-to video is worth even more. These community tools make it very easy to learn a new trick and use it quickly in your project.

Every language has a few things you like and few you dislike. IDE support for static languages make is very easy to navigate the codebase and learn new libraries or framework code. This is not where ruby beats Java or .NET. However there are a lot of areas where ruby\rails and its community has done a great job.

As you can see, a lot of these tools and techniques are possible to replicate in other languages. Ruby's scripting nature made it very easy to develop some of these tools easier in ruby. Other languages will have to find a way to incorporate these efficiencies in their framework. With Java attempts are being made with JRuby, Groovy and Grails. Similar attempts in .NET include IronRuby.

Related posts:

  1. Ruby on Rails with Windows – How I made it work
  2. What Makes Code Great?
  3. A Java Programmer’s transition to Ruby on Rails
  4. Ruby on Rails Internship
  5. Rails Development on Windows: Native or Virtualize

Comments: 4 so far

  1. Ruby is fun because it gets out of your way and let’s you be free to create/program which is the fun part. It doesn’t bog you down with tedious setup/configuration that isn’t fun.

    Comment by Integrum, Wednesday, May 27, 2009 @ 2:53 pm

  2. Sharad! Great post man. Always glad to see you getting some time in on the blog.
    -Ray

    Comment by Ray Krueger, Wednesday, May 27, 2009 @ 7:29 pm

  3. Sorry for the double post; I forgot to mention something. In regards to online documentation, I have to mention the great work being done on the rails guides…
    http://guides.rubyonrails.org/
    I’ve always got one of those guides up when I’m doing Rails stuff.
    -Ray

    Comment by Ray Krueger, Wednesday, May 27, 2009 @ 7:35 pm

  4. @Integrum, nicely stated. While writing this post, I also began suspecting if all these productivity is primarily due to the fact that ruby is truly lean, scripting language. If only JVM were less bloated and didn’t need compilation (which I guess is true now that we have groovy etc.), I could potentially do most of the above mentioned stuff in Java too.

    @Ray, good to hear from you. Thanks for the link, I have been there before but it was just starting out back then. I am sure it is fill with more interesting stuff now.

    Comment by Sharad Jain, Thursday, May 28, 2009 @ 8:36 am

Leave a comment

Powered by WP Hashcash

Launch: Pathfinder Newsletter

    Get a monthly update on best practices for delivering successful software.

    Subscribe via email


    Subscribe via RSS      RSS icon

Topics

Search

WordPress

Comments about this site: info@pathf.com