To Rails 3 or Not to Rails 3, That Is The Question

The release of the web framework, Ruby on Rails 3, may lead to some pretty interesting decisions for current Rails developers.

The description of Rails 3 from the Agile Web Development with Rails 4th Edition (beta) book from the Pragmatic Programmers web site sums it up pretty well:

Rails 3 is a major release—the changes aren’t just incremental, but structural. So we decided to follow suit. This book isn’t just a mild reworking of the previous edition to make it run with the new Rails. Instead, it’s a complete refactoring.

Rails 3 introduces many new things, many new conventions.  Version 3 looks more like a new framework, rather than just a version upgrade.  Previously, the amount of effort to move from one Rails version to another was pretty small and unit tests helped reveal problems.  We still rely on our unit tests for this purpose but the effort is not as small.

Rails 3 does offer many fantastic new features and the new architecture attempts to fix problems and areas where the current Rails framework falls short, but at what cost?   I have heard people say over and over, moving to Rails 3 is difficult.  Will this prevent migrating projects to Rails 3?

Jeremy McAnally has written a great ebook titled Rails 3 Upgrade Handbook where he outlines the tasks developers will face when moving existing Rails applications from version 3.   To quote Jeremy from the book about moving applications to Rails 3:

The new features, performance improvements, and API changes aren’t incredibly drastic, but they do present great opportunities (and challenges) to those looking to upgrade existing code to the newest version.

Jeremy also has a plugin that became an official Rails plugin that helps guide the developer through the upgrade process.

I know with certainty there are Rails developers concerned up moving existing code to a new Rails, new conventions.  One of Rails strengths are the convention it employs and as developers we learn the intricacies of our framework the hard way.  Rails 3 will require an education to learn the new conventions.

Could this be a point in time where faithful Rails developers move on to a different framework? I doubt devotees won’t, but maybe some.

Active Server Pages

Case in point, Microsoft Active Server Pages.

I have witnessed and been involved with this before when Microsoft created a web framework named Active Server Pages, referred to ASP.  After a much successful growth of ASP developers, Microsoft decided to create ASP.NET which is their current web framework based on webforms.

The problem was that even though the product names were very similar, the truth was they were drastically different.  Developers were faced with:

  • No upgrade path – code written with what we refer to today as “Classic ASP” could not moved to ASP.NET.  It required a complete rewrite since the programming model was different than ASP.
  • Big learning curve – Classic ASP uses a scripting language where there was a single page with logic in the page, ASP.NET moved to a page with a code-behind page in either C# or VB.NET.  The two are very different and someone versed in Classic ASP had to learn everything from the ground up

Developers were faced with making the jump to ASP.NET or deciding to move on to something else, leaving behind the gripes of Microsoft.  Some moved to PHP, as it resembled ASP more than ASP.NET.  Some moved to legacy ASP project to Rails, the views looked more like ASP than ASP.NET

Rails

Up until this point, Rails has been a pretty smooth transition from version to version, even when applications were running older versions of Rails such as 1.2.x and moving to 2.x was pretty straightforward.  I moved many Rails 1.2.6 applications to 2.x and faced little major issues, certainly not a rewrite.

This is not the case when moving to Rails 3, there is no smooth upgrade path and users will be forced to rewrite significant parts of their applications.

The architecture of Rails has changed in a big way, mostly by Yehuda Katz of Merb fame.  Rails 3 takes the good from Merb in many ways, as I would expect.  The view from 50,000’, Rails 3 does not closely resemble Rails 2.x as we know it today.

A Fork in the Road?

As was the case with Classic ASP, I think developers either bit the bullet and rewrote their applications with pain and learning, stayed put and are still there today or moved to a different web framework, maybe Rails, maybe PHP.

I think we are at this point with Ruby on Rails.  Developers are faced with the task of moving to Rails 3 and making that technical leap, not to a new programming language as with ASP.NET, but a new framework.   Rails 3 is different enough from any previous version that moving existing application will not be a rewrite but a change enough to be a considerable effort.  Rails developers are well versed in how the framework functions, Rails 3 is very different.

An Opportunity?

This may be an opportunity for other frameworks to gain some traction.  New developers considering Ruby on Rails 3 have a bigger challenge with the framework, it is not exactly the framework DHH developed only a few years ago.

Other frameworks worth considering:

  • ASP.NET MVC – from Microsoft, allows developers to use C# and VB.NET to create scalable web applications pretty easily.  It also has good community support.
  • Django – a Python-based web framework which has many great features and productivity points.  Django has been around for a few years now and gaining a good amount of traction.
  • Sinatra – a Ruby-based framework with a simple, yet powerful implementation.

I could be wrong here but I think the advantage Rails had with an easy-to-learn framework, great productivity and easy upgrades will be a bit strained in Rails 3.

This will surely be a great opportunity for developers well-versed in Rails 3 to start or expand consulting career helping companies with existing Rails code bases upgrading to Rails 3.  I think these folks will be in high demand.

Conclusion

So what will happen?  I don’t know. Rails is a great framework but converting a large code base is going to be a challenge and Rails 3 is the future, not the 2.3.x code base.

I know I have asked more questions than I have answered.  I hope the powers that be in the Rails leadership understand the concern.

UPDATE: As comments have pointed out, if this sounds Rails-negative, it is not meant to be.  I see this a call for people with knowledge of Rails 3, bits of experience with upgrading projects of any size to share the knowledge.  Blog about what you did, even the most mundane details and share what you know so jump ship DOES NOT happen.

  • Pingback: Tweets that mention To Rails 3 or Not to Rails 3, That Is The Question | Accidental Technologist -- Topsy.com

  • Andre L

    I'm confident developers will embrace Rails 3. It's as enjoyable as ever to work with — the new routing DSL alone is worth the price of admission. So far I've upgraded one production Rails 2.3 app to Rails 3, and started one Rails 3 app from scratch. While the upgrade process is harder than it was for previous versions, it was totally manageable. And it will only get easier more people try it and document the process.

  • http://railscasts.com Ryan Bates

    While I do agree Rails 3 is a bigger upgrade than ever before, this post seems like an overreaction. I hope no one walks away too scared to upgrade because they get the impression it will be like rewriting their application – it won't.

    Many of the new interfaces (IIRC routes, Active Record queries, Action Mailer) still allow the old interface but is deprecated. This smooths out the transition somewhat. Also, translating from the old interface to the new one is not too difficult and requires no deep restructuring of an application.

    I expect the average Rails 3 upgrade process to take less than a few hours once one understands the new interfaces. What really helps when upgrading is a full test suite this way one can quickly see everything that is broken without having to manually test the entire application. I wouldn't want to attempt even a minor Rails upgrade without one.

    The biggest pain point will be plugins because those often depend on Rails internals and are likely to break. I encourage everyone to make a branch and try upgrading your app to Rails 3. If there are plugins you use which are not yet compatible please submit tickets to the authors. This will help make the transition much smoother when the final is released.

  • http://www.accidentaltechnologist.com rbazinet

    Ryan, thanks for the reply.

    I didn't intend to come across as an overreaction at all. I just wanted to point out to developers who have done Rails upgrades in the past that this upgrade is not as straightforward. I know a good number of people who have tried to move their projects over and it was full of fail, for one reason or another.

    I agree that becoming familiar with the interfaces is key, but they are different than what we have seen in the past and therefore the learning curve will be much steeper for the average developer. You have an advantage with the learning you have done for the screen casts but someone who works 9-5 may not have the luxury.

    Take the post for what it's worth, I have seen other frameworks in the past take a long time to get traction because developers didn't have the extra time to learn a new way of doing something which on the surface had little ROI.

    Finally, let's face it, people don't test as nearly as much as they should. The Rails projects I have taken on in the past couple years had little or no tests, and I think that is more the norm than full test suites.

  • http://www.accidentaltechnologist.com rbazinet

    Andre, I agree that Rails 3 is filled with a lot of goodness and new projects I am starting up will be all Rails 3. I have a couple internal applications which will be a test bed to force me to upgrade but the experience I have seen with developer upgrading, has been less than spectacular.

    I am very pro 3.0, don't get me wrong. I just hope the community does step up and show how to get past those upgrade hurdles. I plan to do that here on this blog and point out some of the things I have seen and what I run into in the future.

    I hope everyone upgrading blogs about it, even the smallest details and the mundane tasks. This will get as much information out there as we can.

  • http://withoutscope.com/ Rich Cavanaugh

    Rob,
    I'm with Ryan only a bit less eloquent. Rails3 is not final and plugins, which are really the life blood of Rails developers, have largely not been updated yet.

    I honestly think this kind of “abandon ship” article is ridiculously premature.

    My impression after experimenting with moving a few apps (one quite large) over is that once plugins catch up, the migration won't be all that involved.

  • http://www.accidentaltechnologist.com rbazinet

    No, no, no. This is not an abandon ship post. This is a post about keeping people on Rails, wondering if they will jump ship and a call for Rails folks moving project over to Rails 3 to document and share the knowledge. Open source the techniques, the methods and experience.

    I predict a lot of frustration from the average Rails developer if clear guidance is not given.

  • http://drogomir.com/blog Piotr Sarnacki

    I haven't converted any of my apps to rails 3 yet, as I don't maintain any older app in active way, but I have already started 2 new applications using rails 3. As Ryan and others said, API hasn't changed that much and old API is still supported.

    As of plugins. So far, I haven't encountered any plugin that would be extremely hard to run with Rails 3. Many plugins and gems have support for Rails 3 already. The ones that are not yet compatible, often have forks with Rails 3 support on github. That said, there are probably plugins that are still not updated for Rails 3 and it would be hard to do them compatible, but I think that you will rarely notice such thing.

  • mm53bar

    I'll help you clarify one of your points – you are definitely wrong when you say that “…the advantage Rails had with an easy-to-learn framework, great productivity and easy upgrades will be a bit strained in Rails 3.”

    The framework is still just as easy-to-learn and, if possible, even more productive. I'm not a 9-5 Rails dev but I still haven't had any problems upgrading 2.x apps to 3. While the upgrade process isn't automatic, it certainly isn't the “considerable effort” that you describe.

    In my 9-5 job, I typically work in the Microsoft stack. I still remember the painful rewrites associated with migrating Classic ASP to ASP.Net 1.1. Even the step from 1.x to 2.x was painful. Moving from Rails 2.x to Rails 3 is nothing at all like that.

    Have you watched Ryan's Railscasts on Rails3 yet? Or tried a small Rails3 app? The world hasn't changed that much.

  • http://www.accidentaltechnologist.com rbazinet

    Hmm…you live in the Microsoft stack by day, so this must make you a Rails 3 expert. I have done Rails 3 apps and have many Rails 2.3.x apps which are not straightforward upgrades to allow them to run on Rails 3, many of the issues are plugins which are not Rails 3 compatible yet.

    Please take a fairly large Rails 2.3 application with a bunch of plugins, move to Rails 3 and see what issues you have. When you do that, then come back and help me clarify any of my points. I would love to be enlightened by someone who has more Rails 3 experience that I and can help pave a clear path to upgrading.

    Looking forward to your findings.

  • mm53bar

    Whoa! Didn't mean for my reply to come across as snarky or otherwise asshole-ish but I guess it did. You wrote in another comment that part-time Rails devs might have problems upgrading because they don't worth with the framework all the time. As one of those devs, I just wanted to point out that I didn't have a lot of issues.

    But your response makes me wonder about a different question – is the issue with Rails3 or simply with the plugin support for the beta releases of Rails3?

  • http://www.accidentaltechnologist.com rbazinet

    No problem, thank you for the clarification. I think moving to Rails 3 will basically be easy for some (not a lot of gems/plugins, or the less common) or a fair amount of work.

    I am not against work. My post is not against Rails 3 either but more about how other will view the work they need to do. If a developer tries to upgrade and faces a roadblock with a plugin which they aren't willing/able to contribute the fixes, will they just not upgrade? I don't know, this post was about speculation and not about the way it will be.

    So, yes..it is not only about Rails 3 convention changes, but about the gems and plugins we use. I guess we could call the Rails 3 ecosystem because it includes many aspects.

    I have seen many issues already and talked to many developers who have had issues. This is not unexpected, but I wonder how adoption of Rails 3 will fair once it is released. Only time will tell.

  • Pingback: The week in links « turnings

  • Pingback: 레일스3 환경에서 레일스2 애플리케이션 생성하기

  • Moe

    this is an excellent summary as i also lived through this same transition. and look at the massive deprecations coming to the query interface in 3.2.

    rails is changing, however, in an attempt to make it easier to contend with. asp when to .net (java) and raised the bar of complexity 10 fold.

    hopefully rails as a whole gets less “rails” and more grounded on common sense. when you look at the query interface and relationship stuff in rails, it’s not all the straight forward and easy to put together – especially in real world applications.