 |
|
|
 |
|
Ruby On Rails For ASP.NET Developers
|
by Jeffrey Dale Starr, MCSD
First, I must confess: I am a dyed-in-the-wool Microsoft True Believer. I began programming back in the early 1990s using Visual Basic, progressed to old-school ASP, and was an early adopter of .NET (and I quickly switched to my personal favorite of programming languages, C#). I have done plenty of programming in other technologies and camps (ColdFusion, Oracle, Java, etc) but my wheelhouse has always been the Microsoft world.
So when introduced to Ruby On Rails a couple of years ago, I was somewhat skeptical. "What's the point?" I thought. "All programming languages are basically the same, so who needs a new one?"
Well, I was offered a large job two years ago that required me to convert a massive ASP.NET, C# application into a Ruby On Rails prototype. I explained to the CTO that I had no experience in Ruby, but he said that didn't matter - it was much more important to him to have a hardcore .NET developer that could learn Ruby. The pay was right and I'm always open to new technology, so I took the assignment.
Fellow C# Faithful, I must confess - I fell in love with Ruby.
This platform is perfectly suited for setting up Object-Oriented, data-driven web applications quickly and reliably.
How many of us have suffered the pains of creating line after line within Class Objects? (And don't get me started about auto-code-writing tools...not a fan) Line after line of "get" and "set", the properties, the attributes, the methods, whew!
Well, imagine this scenario: You have a table in your SQL Server database called "Person". This table has 20 or so fields: PersonID, FirstName, LastName, etc. You know the drill- create the class object, add attributes for each of your fields, add a select constructor, an update method, maybe a delete method, and whatever else. Creating that class object might take a couple of hours.
Now imagine doing that same thing in Ruby On Rails with the following code:
class Person < ActiveRecord::Base
set_table_name("Person")
set_primary_key("PersonID")
end
And that's it. Really. In fact, if you follow the normal Ruby naming conventions, you don't even need to set the TableName or PrimaryKey - if the class has the same name as the table and the primary key is "{className}+ID", there would literally be nothing else to do in this case to be able to: SELECT a Person by ID, CREATE a new Person, UPDATE a Person, DELETE a Person. Yes, gang, all of the CRUD functionality is wired up for you automatically! Along with all of the corresponding methods and properties.
I know this barely qualifies as scratching the surface, but this was merely meant as an open letter to my fellow ASP.NET, C# warriors: don't turn up your nose at Ruby On Rails. It can be a very exciting and stable alternative to .NET when you need to RAD programming, with emphasis on the "R" (Rapid).
|
|
|
 |