Posts

Showing posts from December, 2011

What's in a name? A lot.

One letter identifier names have been getting bad press recently. The other day a post entitled Name Your Type Variables! got some discussion on the Haskell reddit . I agree with the author's value of good names, but I disagree with the specific examples he uses as well as his sweeping condemnation of one letter names. Since I am the primary author of one of his examples and have contributed code to his other example, I believe I am qualified to comment. Here's the executive summary for the tl;dr crowd: Different naming scopes have different needs for names. Call the two extremes of this continuum rare and prevalent. Sometimes (especially with prevalent names that have large scope) there's too much context to communicate, so no name of reasonable length can be as descriptive as the one-letter critics seem to want. A general rule of thumb is that prevalent abstractions should be given shorter names and rare abstractions should be given longer names. Single letter name