Conciseness > Verbosity > Leaky
Naming is one of those two well known problems in computer science.
It is key to abstraction. An abstraction with a poor name will often be misunderstood.
As I teach myself Clojure, I find myself reflecting on all of the functional code that I’ve seen in my career: the Lisp, Haskell, Erlang, and Clojure.
There is a single common thread through them all that troubles me: the names chosen for their core library. There’s a terseness to all of them. It makes for a steeper learning curve. However, for some aspiring functional programmers, the curve may be so steep as to be exclusionary.
- foldl/foldr (Haskell)
- conj (Clojure)
- car / cdr (Lisp)
Lisp, as the grand-daddy of functional languages, perhaps set the trend. Lisp functions names tend toward the spartan and terse. More recent functional languages perhaps follow suit.
The core functions outline the idiomatic use of the language. And, so, most functional programs I’ve seen have a strong tendency toward abbreviated names for their functions and their variables.
I fail to see how this is a good thing.
I can hear them now: “But, Evan, you’re a pathetic C/Java/Ruby programmer who has only dabbled in functional programming. You just don’t understand.”
What am I missing here? We’re far from the world where programmers may have measure code in byte sizes due to storage constraints. Can we all agree then, in this modern age, that we can stop fussing over saving bytes and just use meaningful (in the literal interpretation: full of meaning) names?
While I prefer conciseness, I’ll gladly take verbosity in its absence. Either are better than a name so terse that it results in a leaky abstraction!
Posted by evan on Monday, December 17, 2012blog comments powered by Disqus