On 31/01/2011 17:54, Ulrik Mikaelsson wrote:
<snip>
One special-case which often cause problems, is function-calls,
especially "method"-calls. Roughly lines like: (note 3-level leading
indent)
             otherObj1.doSomethingSensible(otherObj2.internalVariable,
this.config, this.context);

At this point, I can see two obvious alternatives;
             otherObj1.doSomethingSensible(otherObj2.internalVariable,
this.config,
                                           this.context);
vs.
             otherObj1.doSomethingSensible(otherObj2.internalVariable,
                                           this.config,
                                           this.context);

If only your newsreader were also set to wrap at 90, it would be clearer.

Why align the continuation lines with the open bracket? I think the shortness of lines resulting therefrom is the root cause of what you say next:

Both have advantages and problems. In the first alternative, you might
miss the second argument if reading too fast, and in the second
alternative, the vertical space can be quickly wasted, especially if
the line get's just slightly too long due to many small arguments.
<snip>

If OTOH you stick to a standard number of spaces by which to indent, which generally allows multiple arguments to fit on one line

             otherObj1.doSomethingSensible(otherObj2.internalVariable,
                   this.config, this.context);

you don't lead people into the trap of seeing one argument per line.

That said, I've probably in my time done something similar to your example. And at other times, I might do

             otherObj1.doSomethingSensible(
               otherObj2.internalVariable,
               this.config,
               this.context
             );

Stewart.

Reply via email to