Tuesday, February 19, 2013

The Myth Of Convention Over Configuration

Rails claims that convention over configuration is one of its core principles.

When Rails first arrived, in many instances, it took the greatest ideas and most common use cases of Web development, streamlined them, simplified their developer interface, and repackaged them within cleaner APIs.

There are certainly exceptions, but at that time, "convention over configuration" accurately described a sizeable majority of Rails design decisions. Calling convention over configuration a core principle of Rails was, at that time, in my opinion, entirely accurate. In its early incarnations, Rails replaced configuration with convention in a very literal way — for instance, using code generators to automate database migrations, because there's nothing more ridiculous than endlessly typing the same things over and over again.

When Rails imposed its new convention of RESTful APIs, back in 2006 or so, it departed from this, while still using the same phrase to describe it.

"Convention" comes from a Latin word, convenire, also the root of words like "convene" and "converge." Convenire means to come together. In modern usage, and since at least the year 1440, the word "convention" has not just signified an agreed-upon norm, as in Rails, but also a process of having arrived together at the agreement which ratified that norm.

In other words, it is literally impossible to impose a convention on a community. It is a contradiction in terms, Orwellian doublespeak, and the human-language equivalent of a syntax error.

Fast forward from 2006 to today, and you find Rails often imposing "conventions." In the case of RESTful APIs, this was great. CoffeeScript is a more recent example, and another great design decision in my opinion. And then you get "Rails Is Omakase." (original text here, performed as a comic monologue here)

If you want to use words in English to represent the concepts that they actually mean, with precision, specificity, and integrity, and you've heard that Rails values convention over configuration, but you don't know the secret Orwellian "real meaning" of that phrase, then "Rails Is Omakase" makes absolutely no fucking sense at all. It is literally insane. A person who valorizes convention while disregarding the opinions of other people is an impossible contradiction in terms.

For example:

And what are we supposed to call the incredible transformative influence that Rails has had on so many other frameworks in so many other languages? Should we refer to it as a phase in the history of computer science in which it became conventional to use unconventional conventions? It simply fails at being words.

However, if you know, as all experienced Rails developers do, that

convention over configuration really means curation over configuration,

and that the entire Rails culture has just been using the wrong word for almost a decade now, then "Rails Is Omakase" makes perfect sense. It might still seem a bit silly or overblown, but the words have meaning again.

Curating means picking and choosing the best options. When you go to an omakase restaurant, the chef not only prepares the meal but curates it from the available alternatives. When you read Ruby Weekly or Hacker Monthly you're reading curated links or articles. And when you use CoffeeScript instead of JavaScript because Rails automates that decision for you, which was absolutely NOT a conventional choice at the time, you benefit from a curated technology.

Rails once valued convention over configuration, a very long time ago, but today values

curation over configuration.

Let's just all be honest about that.

Naming is one of the hardest problems in programming, but it's worth it to get names right. Good naming enables you to have discussions which are both precise and accurate. We refactor our code. We should refactor our terminology as well.

I realize that David Heinemeier Hansson has contributed more and better code to the world of open source than I have, or likely ever will, but I think there's also value in using words without breaking them.