[squeak-dev] Re: Code formatting patterns

Bert Freudenberg bert at freudenbergs.de
Mon Oct 7 10:01:14 UTC 2013


On 2013-10-06, at 20:25, Eliot Miranda <eliot.miranda at gmail.com> wrote:

> hence we're left with the war between visual thinkers (rectangular blocks) and verbal thinkers (pascal formatting).  just throwing wood on the fire ;-)

I very much like rectangular blocks as the general formatting rule; this is how Smalltalk code looks "naturally" to me. However, you must *not* put a space inside the brackets because then they draw too much attention, standing there on their own:

	[this is
	rectangular]

vs

	[ this is not
	as rectangular ]

There is, however, one case where the rectangular block formatting falls short, IMHO. That is when the block is the receiver of a message. For those, I still try to make them rectangular, but if that fails to look pleasant I occasionally put the closing bracket below the opening one in a line of its own, followed by the message.

Conventional wisdom says in that case one should refactor the method because it got too complex, which I agree to if there is a part that makes sense as its own method. However, I personally don't like one-off private methods just for the sake of simplifying one method. These typically need many arguments, have perhaps multiple return values, so the resulting complexity is not worth doing it.  Or am I missing something?

- Bert -



More information about the Squeak-dev mailing list