Posted on 25-01-12, 15:37 in The Horstmann brace style (revision 2)
Post: #1 of 1
Since: 01-12-25

Last post: 132 days
Last view: 132 days
The Horstmann style is the best thing invented after the hot water. Personally, I use it with slight modification:

while (x == y)
{ something();
somethingelse();
//...
if (x < 0)
{ printf("Negative");
negative(x);
}
else
{ printf("Non-negative");
nonnegative(x);
}
}
finalthing();

The 1-space before brace visually improves clarity - see how 'else' operator stands out like a wall you can't pass unnoticed. Also it helps to see the thing in braces as "owned" by the previous symbol.
I've been using it since I discovered it. Usually I set tab=4 spaces, code aligns on tabs, first tab after a brace has automatic less positions, better seen in picture (PHP code):

The image is invisible, URL is https://imgur.com/u5dtgVX

absolutely support Horstmann style coding
    Main » Tony G » List of posts
    [Your ad here? Why not!]