back

A little less hokus pokus

My favorite rails commit message: a little less hokus pokus

It’s not an especially serious commit, but it demonstrates how you can be obsessive in a good way about clarity.

1
2
3
4
5
6
7
8
9
10
-      def translate(*args)
-        args << args.extract_options!.merge(:raise => true)
-        I18n.translate *args

# vs

+      def translate(key, options = {})
+        options[:raise] = true
+        I18n.translate(key, options)

While this sounds kind of effete, if I read that code to myself, the first one’s voice would be really crazy and busy, like some sort of commando in a war, while the second one would just be calm and clear.

February 26, 2009

  1. Chris says:

    I like it! As you said: Less hocus pocus and more readability.