Squeak coding style...

Trygve Reenskaug trygver at ifi.uio.no
Sun Feb 29 07:48:52 UTC 2004


Sorry, sorry, sorry. I made my previous e-mail a bit too concise.

My comment was a short version of this, not so short version:

"The most important code styling issue is that the code writer keeps the 
code reader in mind when writing code. We do not write code for a computer, 
a computer accepts almost anything and understands almost nothing. We write 
code for a human and we want to minimize the effort needed by that human to 
understand what we mean.

This means that the code and the code style has to be adapted to the 
reader, the reader's prior knowledge and any common conventions in the 
reader's community. It is a question of an intelligent mind communicating 
with another intelligent mind.

The Scientific American's advice to authors:
     Never overestimate the prior knowledge of your reader.
     Never underestimate the intelligence of your reader.

This also means that I do not believe in automatic pretty-printers. They 
can never hide the unimportant, highlight the important and communicate 
what the reader needs to know. Further, as said by others, it hides the 
writer's unconscious "body language" that is reflected in the code and 
gives the reader important hints as to the mind-set of the writer. 
Artificial intelligence is always artificial, never intelligent.

Most Squeak programmers including you, Stef, write code for our community 
to read and to use. My initial ironic e-mail was addressed to the few that 
have not yet matured to the point where they realize the importance of 
style - any style.

Regards
--Trygve


At 28.02.2004 15:53, you wrote:
>Trygve wrote:
> > A question to anybody writing code in any language:
> >      Do you intend the code to be read, or is it write-only?
> > A word of comfort:
> >      If you don't reveal your name: Don't worry, we understand.
>
>I, for one, intend for my code to be read. And modified. [ And read. And
>modified. ] repeatForever.
>
>In fact, when I write code, I spend a significant amount of time ensuring
>that my code is as correct, clear, concise, and consistent as possible so
>that the next person who reviews it (usually me) can understand the intent
>and function (including me).
>
>At issue here, though, is whether we can "legislate" style. You can't treat
>code like sausage, extruding it through a meat grinder when a method is
>accepted so it all comes out uniformly (cat gut not included). ;-)
>
>But we *can* enhance the existing pretty-printer which can be turned on by
>someone during code review to make sausage more digestible.
>
>(OK, I'd better quit with the meat metaphor while I'm ahead!!)
>
>Chris


-- 

Trygve Reenskaug      mailto: trygver at ifi.uio.no
Morgedalsvn. 5A       http://heim.ifi.uio.no/~trygver
N-0378 Oslo           Tel: (+47) 22 49 57 27
Norway





More information about the Squeak-dev mailing list