Recently, my github news feed got spammed with comments on a commit in rails/rails. People are arguing about a new abstraction layer named coffeescript for generating JavaScript. Is there a way to filter that kind of stuff? I’m all for discussions but not stupid 176 comments like “+1 Awesome core!“ on github. Do that on Lighthouse or on the mailing list.
What is an abstraction layer?
An example: Every kind of framework is an abstraction layer. It saves you from working with concrete code by providing higher-level methods and concepts. Ruby abstracts assembler, Rails abstracts working on HTTP-based applications, ActiveRecord abstracts SQL, and so on.
What’s your problem?
The funny thing is, basically I agree (again!) with dhh and his followers: I like abstraction layers. To be precise, I especially like abstraction layers if
- they are horizontal layers, meaning they are clearly separated modules and not hard-wired in the core like
RJS.ActiveRecordin Rails 3 is a good example of a cleanly encapsulated abstraction layer. - they are optional. Rails has opinionated the process of developing web apps for years (ORMs, monolithic controller/view architecture, pseudo-REST). People are used to it and want soft transitions (well, actually this is not my very opinion, whatever).
- they are vertical layers in a sense of splitting one monolithic app into several manageable component applications. This is also an abstraction layer and completely ignored in Rails.
Have more abstraction layers!
Rails is a web framework and does a pretty good job at it. It gives you PHP-like templating, a great ORM and the FrontController pattern. Now this is Rails status quo.
Abstraction layers must be separate gems with adapter modules for Rails. Rails itself needs an architecture towards this, and Rails 3 already is a great step in this direction.
Abstraction layers should also try to be separate layers and not mix in stuff randomly into M, V, and C at once.
If you hard-wire “abstraction layers” into the core, they are no layers anymore. This is my problem with the current implementation of RESTful representations in Rails. Another example where more work is needed is the view layer. The cells gem helps having object-oriented views by abstracting stupid partials and helpers to view components.
Too much abstraction means Java!
Don’t get me wrong here. I do not evangelize useless abstraction. That’s why I say “Make it optional!“ If you have lot of JS, use coffeescript. If you have RIA frontends or portals in Rails, use Cells or Apotomo. If your CSS is bloated, use Compass, and so on.
But please keep the Rails core an abstract core.
Now, please stop the comment spamming on github and spam me instead.
Tags: rails

Thierry Passeron
+1 Awesome post
bumi
+1 awesome post
Jason
+1 lol
But maybe you could clarify, for the confused, that Coffeescript is a valid abstraction layer for those who chose it, and it’s not a big deal. Reading this it ins’t clear cos of mixed sentiments.
Rodzyn
It’s really good concept about separation abstract layers in gems when it’s up to you what you really wanna use in project. But, I think that Rails core team treats Rails as a fully-prepared-to-work product so they wanna put all that stuff as default.
I’m receiving this like a marketing trick, using external technologies to show how cool is writing in Rails =]
Actually it’s a really good thing for the beginners, they don’t have to look for an external gems, perhaps they don’t know any except rails
Michal Taszycki
I don’t get what you are talking about Nick, flame war on github was superb:) The trolling was definately a art in that case:D
Although the lazy part of me would prefer haml and sass (not scss) as default as well, it’s so easy to change the defaults it doesn’t matter that much.
It won’t make bad programmers write good code (only less:). If you were dropping your jQuery all over the place before, you will still do that with less characters in coffeescript:)
But that IMHO shouldn’t worry you as a consultant who is rescuing legacy apps:)
Mephux
Just fyi.. Coffeescript is not an abstraction layer…
Michel
Is it possible to create a single representation from multiple models?