[Haskell-cafe] Re: Is 78 characters still a good option? Was: breaking too long lines

wren ng thornton wren at freegeek.org
Thu Apr 23 01:11:18 EDT 2009


Maurí­cio wrote:
> > > We have one: urchin.earth.li/~ian/style/haskell.html
> >
> > Yes, it's good. We should publicise it more.
> 
> Just a tought: I would like to see a guide talking about the
> code itself, not about the presentation. Maybe this is ignored
> because it's difficult. It's easy to get bad code and make sure
> it follows strict layout, doesn't resemble imperative code and
> has comments on all functions. It's still bad code.

You've nailed it: "this is ignored because it's difficult." It's nothing 
special about Haskell, it holds for style guides for every language I've 
seen.

It's difficult because it's not a question of science, but rather a 
question of aesthetics. And as anyone in the humanities can tell you, 
when it comes to aesthetics people disagree. But the reason they 
disagree is because of this fundamental truth: there's no right answer. 
There are many wrong answers, to be sure, but there's no right answer. 
To put a finer point on it, not everyone likes the same authors. One 
person's clear discussion is another's pedantry or another's logorrhea.

Consider style guides for writing prose. Many of these are full of 
discussion about where to place commas, or when to use a different word 
because of the possibility for confusion, or when to reorder the parts 
of a sentence. What few of them ever discuss are things like how to 
structure an argument, how to introduce characters, when a character 
should be removed, what makes for an interesting plot, etc. Even those 
that discuss such things are typically vague about it and often make 
appeals to intuitions and aesthetics they presuppose.

Good writers and good coders will learn these things over time but they 
learn them by practice just like any artisan. Good style guides are like 
a good instructor: they can teach you how to use a chisel, but they 
can't teach you how to carve. Over time, with enough experience after 
carving many different things, the good sculptor will come to an 
intuitive understanding about what things will work and what things are 
likely to be problematic. They can pass down the lessons, the horror 
stories, a codification of their hunches, but what they can't teach is 
the intuition itself.

Don't get me wrong, I'd love to see more guides that take on these sorts 
of issues. This is why they're so rare, is all.


My job over the last year has been trying to teach a group of colleagues 
---in person--- about what makes good style. In addition to the issues 
mentioned above, there's another one that looms large. Most people 
already have a style ---good, bad, indifferent--- and they often 
perceive any attempts to change that style as (at best) a frivolity or 
(at worst) an attack on their abilities. Books and webpages can 
circumvent this to an extent (thanks to the selection bias of who would 
be reading them anyways), but any guide that is too challenging will be 
thrown out, no matter how right it is. Thus it takes someone who's a 
good writer, speaker, or manager and not just someone who's a good 
coder. Because the author needs to convey not only the intuition, but 
also enough of themselves that the reader will accept their experience 
and listen to what they have to say.

(And folks who are good with both personal and technical arenas can earn 
a lot more elsewhere than writing guides, so they'd have to be 
charitable and generous as well ;)

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list