Introduction
First up, I have to mention that my first experience in the programming world was with C# .NET. I thought that I would never move to another language never mind leaving the .NET framework.I started working at WhiteWallWeb and the oddity language PHP4. Coming from a completely object oriented approach to the scripting PHP4 pattern really shocked my system – “How clever must you be working with 4000 lines of “if’s” and “else’s” with the occasional “switch case”?” When PHP5 arrived I was back in my comfort zone. We’ve even built our own framework – Muffin. Working with PHP’s unique multiple array structure with the JSON library and the Prototype JavaScript library made me think I was invincible.
Then Ruby on Rails came along…
Having no clue what rails was about – my colleagues and I worked days on winning Rails. Some days it felt like a losing battle, but look at us now – The Ruby Boys.
I have been looking at the ASP.NET AJAX because my .NET colleagues are boasting about it – so I thought I should have a look. My first impression was that it seems to be as simple as Ruby on Rails – for the basic things anyway. Further investigation made me conclude that Ruby on rails is the Mohammed Ali of AJAX development. The best way I could emphasize this statement is by a bout between ASP.NET AJAX and Ruby on Rails Fight Night style.
Tonight’s main event will be the lightweight Ruby on Rails (RoR) VS the heavy weight ASP.NET AJAX
In the blue corner
ASP.NET AJAX
As with all .NET languages, Microsoft Visual Studio provides, according to me, the best IDE interface by far. Drag and Drop what you need on a canvas (web panels), make some minor adjustments and your off. But what if the prebuilt controller fails to meet your client’s requirements? Now that where the all-nighter coffee binges come in. With the weight of .NET’s countless objects, functions and controllers it can take any .NET developer some time to find the exact solutions – to be fair the MSDN is fantastic. If a custom job is needed, the weak MVC framework can easily be decimated by a tired or inexperienced developer. After all the work has been done – you can be assured that your application is built in a prestige language, but don’t ask me to update the code. We can expect fast big punches from this formidable heavy weight.
In the red corner
RoR
Ruby on rails is an enforced MVC framework that handles everything from the database structure and directory structure to the list items in the HTML. The Ruby JavaScript (RJS) is where the real magic lies – with calls to two ruby functions and couple of options inside a hash you can easily generate draggable items with selective properties such as to where they are allowed to be dropped or not. On Drop a specified URL (resource map) will be called and its output will be returned – with the option to update any HTML element on page – keep in mind that this could return more RJS and further the actions. With its Ruby on Rails’ programming language Ruby, its fancy footwork will dazzle .NET’s scripting language and precompiled Framework.
Round 1: Multiple droppables and draggables
Task at hand. Two divs – one is a fruit, the other a vegetable, Two containers – A pot and a basket. The pot should accept vegetables and the basket should only accept fruit.
FIGHT
ASP.NET AJAX makes the first move
I googled comprehensively (about 15 minutes) for a solution. I couldn’t find an easy one anywhere. The best I came up with was this custom extender http://msmvps.com/blogs/omar/archive/2007/03/22/asp-net-ajax-extender-for-multi-column-widget-drag-drop.aspx
Thanks to Omar for his post..NET looks at his trainer (Omar) on the side of the ring with dismay. With after a couple of changes he got halfway through his punch.
RoR blocks and counters it
Setup your draggable items
<div id=”Carrot” class=”vegtable”>Carrot</div>
<%= draggable_element :Carrot %>
<div id=”Apple” class=”fruit”>Apple</div> <%= draggable_element :Apple%>
Setup your droppable containers
<div id=”Pot” class=”container”>Pot</div>
<%= drop_receiving_element “Pot”, :hoverclass => “hover”, :accept => :vegtable %>
<div id=”Basket” class=”container “>Basket</div>
<%= drop_receiving_element “Basket”, :hoverclass => “hover”, :accept => :Fuit %>
RoR made an opening haymaker – The purity of the MVC structure and the help of his two trainers namely Prototype and Scriptaculous made the blow relentless. With all the extra weight of the .NET framework ASP.NET AJAX could not move out of the way. ASP.NET AJAX looks drowsy after the first round.
Judges scores after Round 1
1- 0 to Ruby






Nice post, Ruby on Rails’s definitely a winner. However, wouldn’t it be better to start off from the beginning and compare installation and setup for at least the Ajax abilities?