Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #24029
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Indentation styles |
| Date | 2013-05-12 23:21 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <kmplvt$rk7$1@dont-email.me> (permalink) |
| References | <rationale-20130507160938@ram.dialup.fu-berlin.de> <kmb4h3$mnj$1@dont-email.me> <51904a4a$0$32109$14726298@news.sunsite.dk> |
On 5/12/2013 10:04 PM, Arne Vajhøj wrote:
> On 5/7/2013 10:56 AM, Eric Sosman wrote:
>> On 5/7/2013 10:23 AM, Stefan Ram wrote:
>>> [...]
>>> An indentation of just one space often is too small to be seen
>>> clearly, because the natural width and form of characters
>>> often varies by an amount that is not very much smaller than a
>>> space. Therefore, the indentation should amount to at least
>>> two positions. In order not to waste horizontal spaces, an
>>> indentation of exactly two positions is chosen. This means,
>>> that the left position of the next level is two larger than
>>> the position of the directly enclosing level.
>>> [...]
>>
>> I dimly recall reading, long ago, of someone's actual attempt
>> to measure the readability of different indentation widths. Alas,
>> I can no longer find the reference. I believe, though, that the
>> experiments found two spaces too narrow, four spaces too wide, and
>> eight spaces much too wide.
>>
>> Unfortunately, the remaining span includes two of the most
>> prominent and pervasive numbers of all, and there's no hint as to
>> which to use: The One True Best Indentation Width might be π or
>> it might be e, and I expect the religious debates on the topic
>> will rage endlessly. Personally, I adopt a tolerant stance: Use
>> either e spaces or π spaces according to the teachings of your
>> faith. Using anything else, though, would be heresy. :)
>
> I sure someone has tried measuring what is optimal, but I
> suspect that the difference were pretty small (for realistic
> indentations).
>
> But I am sure that it could be measured that the effect
> of using the same indentation level in a file is huge and
> I strongly suspect the same for using the same in a project.
>
> Which leads to the normal conclusion:
> * make a decision about indentation level and stick to it
> * if there are no strong opinions about it then go with the
> industry standard for that language (4 for Java)
It would be both instructive and liberating, I think, to
adopt indentation widths that are multiples of i. Instead of
pushing the indented line to the right and thereby reducing
the amount of non-white horizontal space available, a pure
imaginary indent would move the text in a direction normal to
the page or display surface: Nearer to the viewer for c*i
with c>0, or further into the background for c<0. The sign
of c could be adjusted automatically by code inspection tools,
positive when the programmer is trying to study the excruciating
details of the code and wants to deep-dive on the interiors of
conditions and loops, or negative when the focus is on the Big
Picture and petty details shouldn't get in the way.
Given the two-dimensional nature of most display surfaces,
plus a third dimension toward or away from the viewer, one might
be tempted to employ indentation standards based on quaternions.
Any "one" so tempted is urged to seek psychiatric help. NOW.
--
Eric Sosman
esosman@comcast-dot-net.invalid
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Indentation styles Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-05-07 10:56 -0400
Re: Indentation styles Arne Vajhøj <arne@vajhoej.dk> - 2013-05-12 22:04 -0400
Re: Indentation styles Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-05-12 23:21 -0400
csiph-web