Rails for .NET Developers - Review

In an effort to continually improve as a developer, one of the things I do is read lots of books. Recently I read Rails for .NET Developers by Jeff Cohen and Brian Eng. Overall, I would definitely recommend this book to any ASP.NET developer that wants to learn more about Rails or wants to better understand the concepts behind MVC.

Given that ASP.NET MVC was heavily influenced by Ruby on Rails, I wanted to learn more about Rails so that I could have a better understanding of how MVC evolved the way it did and how it might potentially evolve in the future. The book did a very effective job explaining Rails concepts while drawing parallels to ASP.NET that I, as an ASP.NET developer, could easily grasp quickly. However, it was written when MVC was still in CTP form so almost all comparisons were from Rails to traditional ASP.NET (not MVC).  Rails is completely different from traditional ASP.NET but incredibly similar to ASP.NET MVC.  In fact, although I always knew that MVC was influenced by Rails, I never realized the extent of just how similar (I daresay identical in many areas) MVC and Rails are. I guess it's true what they say: imitation is the sincerest form of flattery. :)

The book starts out giving a very high level overview of what a Rails application looks like – this provides a solid foundation for the rest of the book.  The next two chapters give a good overview of key concepts in the Ruby language. The book does not pretend to be a full-featured Ruby language reference – it introduces the major language features needed to get up to speed with Rails quickly.

The second section of the book (chapter 4-9), make up the major content of the book. It describes Rails' approach to convention over configuration, REST, CRUD, Routes, Views, and more. I really liked the explanation of the way REST works in the context of Rails. The sidebar at the end of chapter 5 also gives a quick explanation for how Rails handles the PUT and DELETE verbs which is something I think Microsoft should consider baking into the MVC framework. I found the examples dealing with grid data to be pretty good – it's always struck me as interesting that when a traditional ASP.NET developers sees a <% foreach %> in an MVC app for the first time, they freak out. But this is commonplace in the Rails world and not a big deal at all. As long as your view models are clean, I've always felt that using a simple <% foreach %> loop with intellisense for your properites is still more desireable than <% Eval("someProperty") %> but I digress. The chapter on layouts and partial views was quite interesting and you can see the influence of the Rails partial in the MVC2 EditorFor concept. The layouts versus MasterPages discussion was interesting and, while there are many similarities, this was an area where I felt MasterPages shined.

The final section of the book dealt with TDD, integration with .NET, RubyGems, and future directions. These chapters were all of a very introductory nature but the TDD chapter did make me want to learn more about using RSpec with IronRuby (though the examples in the book were with Shoulda, not RSpec). Though there were only 5 pages at the end of the book that discussed ASP.NET MVC, it does make me wonder if they'll eventually put out a second edition of the book that uses MVC comparisons throughout.

In general, there are several reasons why I think it's a good idea to at least be familiar with Ruby on Rails.  First, getting a better technical breadth is always helpful to making you a more well-rounded developer. Also, like me, you may be a developer that has no plans to move away from the Microsoft platform in the near future – but leveraging the best practices and concepts from other platforms can improve your own code as well (translation: we can learn a lot from Rails developers). Microsoft recognizes this and it's the reason they built MVC and IronRuby. The last few years have seen a trend towards dynamic languages like Ruby and IronRuby will soon make the Ruby language a first class citizen in the .NET framework. Before you know it, you could find yourself using IronRuby with MVC.

Tweet Post Share Update Email RSS