Reinier, you forgot to mention that "empty lines" should also contain tabs for 
the right indentation level.

-----Oorspronkelijk bericht-----
Van: reini...@gmail.com [mailto:javapo...@googlegroups.com] Namens Reinier 
Zwitserloot
Verzonden: dinsdag 29 juni 2010 14:41
Aan: The Java Posse
Onderwerp: [The Java Posse] Re: Tab / Spaces anyone?

I don't understand the tabs v. spaces war. There's clearly a right
answer:

Tabs for indents. Spaces for spacing.

Rule #1: A tab character can never occur in any source file, unless the 
previous character is (A) a tab, (B) the start of the file, or (C) a newline. 
Tabs anywhere else are by definition illegal and should have been done with 
spaces instead.

Rule #2: Tabs are for _indents_ only. If you need to line things up vertically, 
you need spacing. Indent that line with however much indent it needs, then add 
spaces at the end of the indent tabs to line it up.

For example, if you're one of those people who like to line up continued lines 
to a semantically logical place, you can do that.
Something like this:

        private int x = 10,
                          y = 20;

is then done by tab-indenting both lines to whatever indent you need, then 
using exactly 12 spaces to line the 'y' up with the 'x' (12, because there are 
12 characters in the text "private int ".

With this rule, you can set tab stop to whatever you want, it won't change 
relative indents. Nevertheless lazy cursor key navigation is much quicker (it 
skips through tabs faster), there's actually a semantic indicator of indent vs. 
spacing which is nice, and there's
flexibility: Folks with tiny screens can lower tab-stop size so they don't have 
to horizontally scroll so much, but folks with gigantic screens can increase 
the size and make scoping more obvious.

On Jun 29, 8:01 am, Amarjeet Singh <amarjeet.aur...@gmail.com> wrote:
> It was years back when I went to this site, but my understanding is 
> that this is a predominantly a .NET/M$ oriented site. If yes, then the 
> results are a no surprise!
>
> Regards
>
> On Mon, Jun 28, 2010 at 10:57 PM, ebresie <ebre...@gmail.com> wrote:
> >http://www.codeproject.com/Surveys/1049/Soft-tabs-spaces-or-Hard-tabs...
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "The Java Posse" group.
> > To post to this group, send email to javapo...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > javaposse+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/javaposse?hl=en.
>
> --
> Amarjeet Singh
> Phone: +91-98712-76661

--
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javapo...@googlegroups.com.
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.


-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javapo...@googlegroups.com.
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to