Ernie Miller

No, I don't work in NYC, DC, or the valley, and I'm cool with that.

RSS Feed

“WTH is happening to Rails?” I’ll tell you.

Posted by Ernie on June 14, 2011 at 8:00 am

I just read the blog post that got some traction on HN last night, entitled “What the hell is happening to rails?” It goes on to list a litany of complaints against changes in Rails 3.x, ranging from the default commenting of the catch-all route to, yes, of course, CoffeeScript. They all end up sounding a lot like “I don’t like change,” an argument we’ve all heard before. The difference is that Steve Coast, the post’s author, casts himself in the role of a crusader for the newbies. He says that he, personally, “gets” why these changes were made, but that the most recent versions of Rails are actually harder to learn than the older ones were. The post highlighted two things, to me:

  1. Some people still miss the point of Ruby on Rails, even after all these years.
  2. There’s a difference between “easy to learn” and “easy to use,” and when these competing goals butt heads, the latter should always win out.

Conventions necessitate opinions

We often say that Rails is an opinionated framework. It chooses sides. It has an opinion about what format our view templates should be in (ERb), what testing framework we should use (Test::Unit), and what Javascript DOM manipulation library we should use (Protoype. No, wait! jQuery! What were we smoking?). It has opinions about where we should put our application’s files and logs, what settings we will want to enable and disable for different application environments, and so on.

This is all good. Rails makes a reasonably sane default choice for us and saves us from making our own decisions until we actually care enough about some aspect of our application to form an opinion of our own. It makes changing our decision possible, and often simple. We enjoy these benefits stemming from the principle of convention over configuration, and it would seem that some of us forget that for a convention to exist, someone (an individual or collective someone) must decide that one way of doing things is better than another.

The “right way” to do things

Steve points out:

The barrier to entry to learning rails if you came from something like PHP used to be pretty high. You had to get your head around MVC, the quirks and so on. But it was doable.

It reminds me of a discussion I had a while back. An developer with plenty of experience in PHP and other languages was complaining that he didn’t like working with Ruby, nor Rails, because there seemed to be the notion that there was generally a “right” or “accepted” way to do things in these communities.

This really floored me. Mostly because:

  • If you’re learning a new language, a strong community consensus about a right and a wrong way to tackle problems aids learning. It increases the likelihood that you’ll pick up good habits from the community as you learn. Even in cases that are more ambiguous, a community passion for doing things the right way means that there will be ample debate about what the right way is, for the newbie to digest and form his or her own opinion.
  • In most cases — for mere humans, anyway — there really is a right way to do things. Ruby is an Object Oriented programming language. There are literally decades of prior research in the field of OO software design, and they’ve resulted in a lot of really well-documented and well-tested design patterns for building software. While it may be possible that the design you’ve build for your application really is far better than the designs of those who’ve gone before, you’ll have to forgive us if we’re skeptical at first.

In any case, when you’re learning to write Ruby on Rails code, you’re not just learning a language or a framework, and a developer’s arbitrary API design decisions. You’re also learning the fundamentals and benefits of solid object-oriented software engineering, through practical implementation. You’re employing a well-respected pattern for separation of concerns (MVC) as you write your models, views, and controllers. You’re using an implementation of the Active Record pattern (you didn’t think ActiveRecord was only the name of a library, did you?) as you interact with the data in your RDBMS. You’re learning about polymorphism and composition and a ton of other OO principles as well, just by doing the research required to write your first Rails application.

And, hopefully, you’re learning the value gained from having so many of these routine engineering decisions already made and already implemented.

Fighting the framework

The great thing about working with opinionated software like Rails is that it can help guide you as you build your application, and as a result, your application will benefit.

When I teach an Introduction to Rails class, one of the first things I tell students is to pay attention to what the framework is telling them. If, while coding something, it seems as though things are much harder than they need to be, it’s very likely that they’re “fighting the framework,” and they should double-check their assumptions to ensure that:

  1. What they’re doing is a good idea, and
  2. There isn’t actually a more straightforward way to do it, already provided or encouraged by Rails

Nine times out of ten, for a newbie, they’ll find that they missed some part of Rails functionality that already solved this problem for them, or that their idea wasn’t following a solid OO design principle to begin with, and should be rethought. You have to know why the rules are there before you start breaking them.

The answer

The complaints that Steve raises in his post are nothing new. They’re simply a continuation of the same thing that Rails has always done — eliminating repetition, solving problems common to most web applications, and generally making the framework easier and more pleasant to use.

Steve says:

Rails is busy optimizing for the anal superior coder who wants to learn things for the sake of learning things, which is neat and cool but not worth it if you just want to make a website.

I wouldn’t have it any other way. If, as coders, we aren’t constantly striving to improve the status quo, what’s the point?

The only people who will suffer from this continuing effort are those who need to unlearn bad habits. As for the true newbies? At least they’ll be learning how to build software the right way, and they’ll take away lessons that they can reuse no matter what language or framework they end up using next.

So…

Q. “What the hell is happening to Rails?”
A. It’s growing up.

Filed under Blog
You can leave a comment, or trackback from your own site.
  • Francisco J. C. Caballero

    genial

  • Jrod

    I agree completely. Great rebuttal. 

  • http://squiid.com Shaun Robinson

    Really great post.  I just finished my first major Rails app using Rails 3, and while I’ve built dozens of websites in the PHP world, this was the first time I truly learned software engineering principles via the OO nature of Ruby and MVC pattern of Rails.  These two paradigms made my app very easy to develop, discuss, and debug.

    Each aspect of my app presented a learning challenge — authentication, payments, full text search, automatic emails, integration with several APIs, invoices, & state machines (oh my!) —  but I was able to surmount all through a Rails way or an easy well documented gem. Everything I built this first time around can be much more easily recycled in my next app. The app runs lightning fast as a compiled slug on Heroku and is rock solid as the user base grows. 

    Each piece was a learning experience, but with each accomplishment I “got” the Rails “way”. And because of the conventions, my learnings carried from one gem to the next, from Mongoid to Devise to Paperclip to State Machine, and so on. I am hooked :)

  • Pavankumar K

    Interesting thanks for sharing

  • http://michaelkellysutton.com Kelly Sutton

    I recently dove back into developing a few smaller Rails 3.0 apps after an extended break from the framework. (The last version I used extensively was 2.8.7.) I agree with everything in this post and then some. Like you argue, my exposure to Rails has made me a better programmer in other languages, like the Perl and JavaScript I spend my days in at blip.tv.

    Teaching myself Rails in school was one of the better decisions I’ve made. The framework reinforces all of the stuff one learns later in a good undergrad curriculum.

  • J.

    Well said!

  • anton

    i think something else is happening to rails.
    some good guys have left the team and DHH turns out to be more and more of a arrogant prick.  his r2011 keynote was really annoying me, trying to sell ‘his greatness’.  in my opinion he could have far better used the opportunity to show humbleness and bow to the community around rails.  the community has achieved (sprockets, jquery, bundler, sass, datamapper, mongoid, looooaaaaaadds of rails-pluginable gems), and i just feel he makes it look too much as if it were his achievements.

  • anton

    i think something else is happening to rails.
    some good guys have left the team and DHH turns out to be more and more of a arrogant prick.  his r2011 keynote was really annoying me, trying to sell ‘his greatness’.  in my opinion he could have far better used the opportunity to show humbleness and bow to the community around rails.  the community has achieved (sprockets, jquery, bundler, sass, datamapper, mongoid, looooaaaaaadds of rails-pluginable gems), and i just feel he makes it look too much as if it were his achievements.

  • Anonymous

    “While it may be possible that the design you’ve built for your
    application really is far better than the designs of those who’ve gone
    before, you’ll have to forgive us if we’re skeptical at first.”

    By the way, while Rails may have strong opinions about the ‘right’ way to do things, I would say Ruby is pretty agnostic about such things (compared to say, Python, for example…).

  • Anonymous

    I’ve never met him so maybe he’s an arse, but you’re wrong about one thing: Rails wouldn’t have happened without him. Yes, the community built on and expanded beyond the Rails he created, but that doesn’t change that fact, none of the community work would have existed without his seed crystal.
    I prefer Django and Python to Ruby on Rails, but modern web frameworks owe a lot to DHH even if only for the fact that he created a buzz for best practices.

  • Me

    I disagree greatly.

  • Anonymous

    “It’s growing up” sounds like “it’s turning into java”

    Now I know it’s not that bad but I can see a future where instead of just having the rails book, you have books for every new thing and option possible and the section looks like the Java section where Struts, Spring, and even Scala/Clojure all make the idea of switching to to rails seem far more daunting than it needs to be.

  • http://erniemiller.org Ernie Miller

    Not at all. For Rails to grow up means something very different than it does in the Java world, not the least because Rails doesn’t place backward compatibility on the kind of pedestal that Java does. When new releases happen, they take the opportunity to deprecate and/or remove implementations whose time has come and gone.

  • Auguest

    I like your explanation about fighting the framework. You sometimes here this about JSF as well (a framework that in its latest incarnation publicly admits to have been influenced by RoR).

    People say they are fighting the framework, but often they are just fighting with their old habits of not organizing their code according to MVC principles and doing stuff like validation wherever it suits them instead of following the pattern that all values from the client should be converted from strings and validated as soon as possible in one particular phase of the request handling.

  • Linus

    Sorry I can’t take this seriously when you start talking about how well designed it all is and then start talking about ActiveRecord.

  • http://erniemiller.org Ernie Miller

    All I said about ActiveRecord is that it’s an implementation of the Active Record pattern. Troll?

  • http://www.facebook.com/mkoenraadt Mathijs Koenraadt

    I’m a PHP user and never went into Rails because I consider it the Dodo of frameworks. The Dodo went extinct in the 18th century.

  • Not Linus

    Yup, ‘troll’ perfectly describes your post.

  • http://www.facebook.com/cjharrelson Jason Harrelson

    Rails is actually easier to learn now than ever.  Just because you hear a bunch of new buzz words for technologies within Rails does not mean you must pay attention to them immediately.  The fact that Rails is opinionated means that it makes choices for you in areas that you yet to care about or have yet to consider. 

    This quality of the framework allows one to concentrate on learning one thing at a time.  If you do not understand MVC, then certainly that will be the first thing you tackle.  If you have worked with MVC before, you may tackle something else first.

    In addition, many of the APIs within Rails have bene simplified and are easier to learn. ie. ActiveRecord with chain-able query methods from Arel.

    Those who are complaining about the chagnes are probably just being lazy.  In my opinion, if you are a developer who does not like change and consistent learning, then you should quit developing.  The very nature of a true developer is one who constantly solves problems.  This includes problems within our tools.

    We will never quit moving forward!

  • http://www.facebook.com/cjharrelson Jason Harrelson

    Rails is actually easier to learn now than ever.  Just because you hear a bunch of new buzz words for technologies within Rails does not mean you must pay attention to them immediately.  The fact that Rails is opinionated means that it makes choices for you in areas that you yet to care about or have yet to consider. 

    This quality of the framework allows one to concentrate on learning one thing at a time.  If you do not understand MVC, then certainly that will be the first thing you tackle.  If you have worked with MVC before, you may tackle something else first.

    In addition, many of the APIs within Rails have bene simplified and are easier to learn. ie. ActiveRecord with chain-able query methods from Arel.

    Those who are complaining about the chagnes are probably just being lazy.  In my opinion, if you are a developer who does not like change and consistent learning, then you should quit developing.  The very nature of a true developer is one who constantly solves problems.  This includes problems within our tools.

    We will never quit moving forward!

  • tom

    I developed a lot with PHP (pure and with Zend Framework), Java (pure and with Spring Framework) as well as some arguably smaller apps with Python and Django. And of course Rails 2 & Rails 3! I can just summarize that Rails 3 is the best choice for 90% of typical Webapplications.

  • tom
  • Guest

    Absolutely. RoR’s AR is effectively an ORM. This is not what Fowler describes in POEAA. AR is not an ORM. It’s a Data Source Architectural Pattern and not an Object-Relational Pattern. Because of that misunderstanding and abuse of AR, countless people nowadays think the M in MVC is equal to the Database when it’s not. It’s only recently that the RoR guys introduced DataMapper as well to allow for rich domain models that are not tightly coupled to the DB.

  • mull

    We consider PHP the Dodo of languages. ;-)

  • HDH

    You don’t get it. Back then when Rails was nothing compared to Java, and as a consequence simpler as well, Rails gods were arguing that’s what a framework, ecosystem, etc. should be like! Now that Rails is trying to become more like Java, they say it wasn’t right to be simple and they’re defending it to death. Just like you.

  • HDH

    And Java wouldn’t have happened without Gosling. And .NET wouldn’t have happened without Anders. And Erlang wouldn’t have happened without Joe. So what?

  • http://erniemiller.org Ernie Miller

    You didn’t read the article if you seriously think the Rails version of
    “growing up” looks anything like Java.

  • yourmom

    ahhh… the old “my framework sucks more than your framework” argument – a playground for software bigots and trolls.  Hey, I have an idea: if you don’t like it, why don’t you just not use it? And shut the f up.  

About

I'm Ernie Miller. But then, you probably knew that by looking at the page title, or the URL. I'm a Ruby programmer in Louisville, Kentucky. This blog used to be called "metautonomo.us", which I thought was kind of clever, but nobody, including me, could type it. Lesson learned.