Archive for the ‘RoR’ Category

Fun with Ruby: The RubyGem Package Manager and the Test-Unit Gem

February 2nd, 2009

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
 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.

Author: Adam Kahtava Categories: Programming Languages, RoR, Software Tags:

MVC is a Welcome Addition to ASP.NET, but…. MVC Frameworks, like Ruby on Rails are More Mature

November 26th, 2008

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 – again, 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 solely dependent on the POST).

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 the .NET community.

Author: Adam Kahtava Categories: .NET, ASP.NET, ASP.NET MVC, RoR Tags: