What is the Rails Question?


Nick Malik asked “what is the Rails “answer” on the Microsoft platform? If we don’t install Ruby, do we use Rails on JS or is there a Rails version we may want to put up ourselves?” I guess it depends, what is the Rails “question”?

On the one hand, the question could be “What’s the best way to run Rails on Windows?” I think the short answer to that is IronRuby. In the wake of the IronRuby announcement, John Lam wrote that “Nobody would take our implementation seriously if it doesn’t run Rails.” Somepeople question the DLR’s teams ability to ship a compatible version of Ruby without looking at the source, but my money is on the DLR team. (Of course it is, I’m a kool-aid drinker!)

BTW, I don’t think having a JavaScript port of Rails (JailS?) is much of a help for the Microsoft platform. I’m not sure if Steve Yegge’s JavaScript Rails port would run on JScript.NET, but I wouldn’t bet on it. I would expect you need either the old Active Scripting JScript or the new Managed JScript (aka the DLR based version of JavaScript). Of course, IronRuby runs on DLR as well so why wouldn’t you just run Rails on IronRuby instead of the JavaScript port of Rails on Managed JScript?

(Side note – why isn’t the new JScript engine called IronJavaScript? Wouldn’t that be cooler than Managed JScript? Don’t they know “Iron” is the new “#”?)

On the other hand, maybe the question is “can ASP.NET evolve to be more Rails-esque?” I think it’s starting to, slowly. Rails at it’s core is a Model View Controller web app pattern (aka Action Pack) combined with an Active Record data access pattern (aka Rails’ Active Record). Certainly, nothing stops you from using a similar approach with ASP.NET. The Castle Project has an ASP.NET implementation of MVC (aka MonoRail) and Active Record (also called Active Record). But I assume Nick’s more interested in what ships natively in the platform to compare to Rails.

On the data access side, I think LINQ to SQL is a a compelling alternative to the various Active Record implementations. It’s not an implementation of the Active Record pattern, it looks more like a Table Data Gateway patten. Also, it’s not DRY like Rails Active Record, but I think that’s more of a function of dynamic vs. static languages. Castle Active Record isn’t DRY either. But once you get the hang of the slightly funky syntax (the from clause is first so you can get intellisense) I find LINQ very easy to use. Certainly, building Query Objects is a snap.

On the web app framework side, the story isn’t so pretty. The agile folks like MVC because it’s easier to test (among other reasons – see update below). Apparently, there’s an ASP.NET MVC framework that’s “in the works“, but AFAIK no one has seen or heard anything about it since the MVP summit. Jeffrey Palermo was impressed with what he saw, but I guess everyone else has to reserve judgement until it gets a little more public.

Actually, I don’t think it’s an either-or question, it’s both. In order to be the Common Language Runtime, I think it needs to support common dynamic languages like Ruby, Python and JavaScript natively. And, in order to be the best platform, I think the .NET Framework in general and ASP.NET in particular need to support multiple approaches to meet the needs of different developers.

UPDATE – in the comments, Jeffrey Palermo points out that he likes MVC “mostly because it separates concerns of controlling screen and rendering the screen. It makes the application more maintainable and keeps the code easily changeable.” Point taken. I didn’t mean to imply that testability was the only virtue of MVC.


4 thoughts on “What is the Rails Question?

  • Jeffrey Palermo

    >”The agile folks like MVC because it’s easier to test.”<

    I would consider myself and “agile folk”, but I like MVC for other reasons, not because it’s easier to test. I like it mostly because it separates concerns of controlling screen and rendering the screen. It makes the application more maintainable and keeps the code easily changeable.

  • Mitch Barnett

    Slowly is right – As an old time ASP.NET developer and using ASP.NET AJAX for the last year (all early CTP’s), I still need all the help I can get.

    The GridView control still needs to be sub-classed and overridden if you want something as simple as horizontal scrolls bars or remember scroll position on partial postback or even what row you selected (onpostback again). Meaning the controls could be a lot more rich and powerful and I don’t know how improved it is in Orcas.

    Also, I end using other JavaScript frameworks (i.e. Sam Stephenson’s Prototype) or even roll my own cause I can’t get synchronous support in ASP.NET AJAX framework. ASP.NET just needs to catch up…regardless of MVC pattern.

  • Mike Moore

    ASP.NET does not use MVC, it uses a Page Controller.

    http://msdn2.microsoft.com/en-us/library/ms998548.aspx

    ASP.NET punished you if you want to care about request dispatching, pretty URLs, or just keeping your code DRY. Page controls, post-back, and view-state are great, but akin to putting lipstick on a pig. I’d rather use IronRuby on Rails than ASP.NET for web apps of moderate to heavy complexity.

Comments are closed.