Ruby is consistently placed as one of the ten most popular programming languages - see the TIOBE Programming Community Index for more language comparisons. Matz (the creator of Ruby) described his guiding philosophy for the language as one that’s “designed to make programmers happy”. While the Ruby language gets a lot of praise for its zen like qualities, its clarity, and terseness. The tools surrounding Ruby like the RubyGem Package Manager along with its active community and growing collection of Gems (view the list here) are often overlooked.
I like the RubyGem system just as much as Ruby, it makes a developer’s life easy.
For example, let’s say I want to design a new class:
- Install Ruby
- Install the Test-Unit Gem (along with a couple automatically installed prerequisites):
C:\>gem install test-unit
Successfully installed test-unit-2.0.2
Successfully installed hoe-1.8.3
Successfully installed rubyforge-1.0.2
Successfully installed rake-0.8.3
- Create a new test.rb file along with a new class.rb file (alternately we could have used the Interactive Ruby Shell directly from the command line)
- Run the test (test.rb):
C:\>ruby test.rb
Loaded suite test
Started
.
Finished in 0.001 seconds.
1 tests, 1 assertions, 1 failures, 0 errors
- ???
- Profit!
Contrasting this to the Java / C# world: I’d be installing a compiler (or slower yet an IDE), then installing / configuring a testing framework. I’d also probably be installing a build process tool (like ant / nAnt), then I’d need to create a build file.
Similarly if I wanted to install Rails at the command line I specify gem install rails or if I want to useĀ RSpec gem install rspec.
The Ruby tools, ecosystem, and community is fantastic.
The Model View Controller (MVC) pattern is a great addition to ASP.NET. The MVC pattern was first described in 1979 by the SmallTalk community - those crazy SmallTalk guys!
Today Wikipedia lists 80 different web frameworks that use MVC - with Java and PHP topping the list for the languages with the most MVC web frameworks. MVC enforces a separation of responsibilities: Markup / CSS / JavaScript, Domain Objects / Containers, and Actions / Controls are broken up into their respective directories. In addition MVC provides the ability to test most of your code and is more intuitive with how the web works (REST like, based on URIs, plays nicer with the browser, and not dependent on POST backs).
Finding good resources specifically for ASP.NET MVC is impossible at this time, but the books covering Ruby on Rails (RoR) are invaluable. RoR has been around since 2005, it uses the same basic MVC approach, similar routing, similar control structure, has a mature community, a large collection of plug-ins, and well established tools (anyone claiming that ASP.NET MVC can’t do what WebForms can, should look to Rails as an example). Gasp! It’s almost like ASP.NET MVC has copied Rails!!
Anyhow; the more I learn about Rails and Ruby, the more I realized that the communities like RoR (SmallTalk, and even some of the PHP world) are years ahead of my native .NET community. At this point I’m considering abandoning .NET in favour of Ruby / Rails / RSpec or at least Merb / Ruby / RSpec. In the future when ASP.NET MVC and IronRuby are more mature or when the corporate world starts using ASP.NET MVC (read never ever!) or when I’m approached to work on an ASP.NET MVC project I might move back into ASP.NET. In the mean time I’d like to contribute to IronRuby as I work towards jumping my current technology stack. I’ve armed myself with Textmate (the E Text Editor) and a MacBook Pro is in my future. I’ll get back to you on how this goes.