Anyone up for a religious war? (low priority)  
Author Message
Piotrek





PostPosted: Thu Sep 02 15:57:09 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority)

I'll pose the question this way... :-)

Which is better to use, spaces or tabs in code (SQL, c++, ...)?

The applications developers here are split between the two. The SQL
developers here have a consensus on spaces (4 spaces per tab key). And
there are lots of pros and cons to boths sides of the argument.

SQL Server226  
 
 
Adam





PostPosted: Thu Sep 02 15:57:09 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority) Tabs are much better for everyone involved... If you prefer to change the
width in your editor, go for it. I can change it in my editor to whatever
I'm comfortable looking at. And we'll both be happy. Editing out tabstops
is also much easier (hit delete once instead of however many spaces if you'd
configured tab to put in a space).

What are the pros of spaces? I can only think of cons at this point. I
used to be a spacebar advocate (2 or 3, 2 preferred), but that was when I
was using inferior editors that couldn't change the tab size...




> I'll pose the question this way... :-)
>
> Which is better to use, spaces or tabs in code (SQL, c++, ...)?
>
> The applications developers here are split between the two. The SQL
> developers here have a consensus on spaces (4 spaces per tab key). And
> there are lots of pros and cons to boths sides of the argument.
>
>


 
 
Eric





PostPosted: Thu Sep 02 15:58:14 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority) My pinky prefers the tab key (which incidentally is set to 3 spaces)




> I'll pose the question this way... :-)
>
> Which is better to use, spaces or tabs in code (SQL, c++, ...)?
>
> The applications developers here are split between the two. The SQL
> developers here have a consensus on spaces (4 spaces per tab key).
> And there are lots of pros and cons to boths sides of the argument.


 
 
payson_b





PostPosted: Fri Sep 03 13:06:28 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority) How does one set the tab width in Query Analyzer? If I could do that,
I would certainly prefer tabs.

Payson


> Tabs are much better for everyone involved... If you prefer to change the
> width in your editor, go for it. I can change it in my editor to whatever
> I'm comfortable looking at. And we'll both be happy. Editing out tabstops
> is also much easier (hit delete once instead of however many spaces if you'd
> configured tab to put in a space).
>
> What are the pros of spaces? I can only think of cons at this point. I
> used to be a spacebar advocate (2 or 3, 2 preferred), but that was when I
> was using inferior editors that couldn't change the tab size...
>
>


> > I'll pose the question this way... :-)
> >
> > Which is better to use, spaces or tabs in code (SQL, c++, ...)?
> >
> > The applications developers here are split between the two. The SQL
> > developers here have a consensus on spaces (4 spaces per tab key). And
> > there are lots of pros and cons to boths sides of the argument.
> >
> >
 
 
Adam





PostPosted: Fri Sep 03 13:15:00 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority)


> How does one set the tab width in Query Analyzer? If I could do that,
> I would certainly prefer tabs.

Tools->Options->Editor->Tab size (in spaces)


 
 
Roji





PostPosted: Fri Sep 03 13:17:23 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority) Tools-> Options
Select The Editor Tab
you have an option called

Tab Size (in spaces)

--
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com




> How does one set the tab width in Query Analyzer? If I could do that,
> I would certainly prefer tabs.
>
> Payson
>


> > Tabs are much better for everyone involved... If you prefer to change
the
> > width in your editor, go for it. I can change it in my editor to
whatever
> > I'm comfortable looking at. And we'll both be happy. Editing out
tabstops
> > is also much easier (hit delete once instead of however many spaces if
you'd
> > configured tab to put in a space).
> >
> > What are the pros of spaces? I can only think of cons at this point. I
> > used to be a spacebar advocate (2 or 3, 2 preferred), but that was when
I
> > was using inferior editors that couldn't change the tab size...
> >
> >


> > > I'll pose the question this way... :-)
> > >
> > > Which is better to use, spaces or tabs in code (SQL, c++, ...)?
> > >
> > > The applications developers here are split between the two. The SQL
> > > developers here have a consensus on spaces (4 spaces per tab key).
And
> > > there are lots of pros and cons to boths sides of the argument.
> > >
> > >


 
 
Gert-Jan





PostPosted: Fri Sep 03 15:10:10 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority) I always use spaces. This way I am sure it will always show exactly the
same, regardless which tool I use for editing or printer.

I really don't like tabs. Especially if I am running through some code
with the cursor and it jumps left and right. In the end it always ends
up left from where I started.

My 2 cents,
Gert-Jan



>
> I'll pose the question this way... :-)
>
> Which is better to use, spaces or tabs in code (SQL, c++, ...)?
>
> The applications developers here are split between the two. The SQL
> developers here have a consensus on spaces (4 spaces per tab key). And
> there are lots of pros and cons to boths sides of the argument.

--
(Please reply only to the newsgroup)
 
 
Steve





PostPosted: Fri Sep 03 17:52:11 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority) I agree completely! But I have nothing against the tab *key*. It's
only tab *characters* that I dislike, for the exact reasons Gert-Jan
gives. The tab key is a very handy way to enter a specified number of
spaces (usually two), and I use it often in Query Analyzer to indent a
block of code by two spaces (or with Shift, to outdent/unindent the block) .

I don't know what tab-user Adam's excellent SQL looks like in his own
newsreader, but here's a recent example from the many that appear to
have suffered from <tab> use (view it with a fixed-width font). Whether
I read it in my newsreader, or through Google Groups, the lines are
indented by 0, 20, 20, 16, and 0 spaces, respectively.

SELECT CASE
WHEN LEN(YourCol) > 50 THEN LEFT(YourCol, 50) + '...'
ELSE YourCol
END AS YourColEllipse
FROM YourTable

I also think tab characters are not ANSI/ISO standard separators. This
is from the SQL-92 standard: <separator> ::= { <comment> | <space> |
<newline> }..., and in the same document, <space> is defined as the
space character, which the standard requires in the character set used
for expressing the language.

Steve Kass
Drew University




>I always use spaces. This way I am sure it will always show exactly the
>same, regardless which tool I use for editing or printer.
>
>I really don't like tabs. Especially if I am running through some code
>with the cursor and it jumps left and right. In the end it always ends
>up left from where I started.
>
>My 2 cents,
>Gert-Jan
>
>

>
>
>>I'll pose the question this way... :-)
>>
>>Which is better to use, spaces or tabs in code (SQL, c++, ...)?
>>
>>The applications developers here are split between the two. The SQL
>>developers here have a consensus on spaces (4 spaces per tab key). And
>>there are lots of pros and cons to boths sides of the argument.
>>
>>
>
>
>
 
 
Andrew





PostPosted: Fri Sep 03 18:41:20 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority) I agree. When I was heavy into Visual FoxPro programming I was dead set
against using spaces and always preferred tabs. That is because I always
used the VFP editor and it always looked the same. Now with TSQL I can't
imagine using anything other than spaces since there are so many tools and
ways to view the code. So many times I audit clients and have to weed
through code with tabs that is so poorly formatted it hurts.

--
Andrew J. Kelly SQL MVP




> I agree completely! But I have nothing against the tab *key*. It's
> only tab *characters* that I dislike, for the exact reasons Gert-Jan
> gives. The tab key is a very handy way to enter a specified number of
> spaces (usually two), and I use it often in Query Analyzer to indent a
> block of code by two spaces (or with Shift, to outdent/unindent the block)
.
>
> I don't know what tab-user Adam's excellent SQL looks like in his own
> newsreader, but here's a recent example from the many that appear to
> have suffered from <tab> use (view it with a fixed-width font). Whether
> I read it in my newsreader, or through Google Groups, the lines are
> indented by 0, 20, 20, 16, and 0 spaces, respectively.
>
> SELECT CASE
> WHEN LEN(YourCol) > 50 THEN LEFT(YourCol, 50) + '...'
> ELSE YourCol
> END AS YourColEllipse
> FROM YourTable
>
> I also think tab characters are not ANSI/ISO standard separators. This
> is from the SQL-92 standard: <separator> ::= { <comment> | <space> |
> <newline> }..., and in the same document, <space> is defined as the
> space character, which the standard requires in the character set used
> for expressing the language.
>
> Steve Kass
> Drew University
>
>

>
> >I always use spaces. This way I am sure it will always show exactly the
> >same, regardless which tool I use for editing or printer.
> >
> >I really don't like tabs. Especially if I am running through some code
> >with the cursor and it jumps left and right. In the end it always ends
> >up left from where I started.
> >
> >My 2 cents,
> >Gert-Jan
> >
> >

> >
> >
> >>I'll pose the question this way... :-)
> >>
> >>Which is better to use, spaces or tabs in code (SQL, c++, ...)?
> >>
> >>The applications developers here are split between the two. The SQL
> >>developers here have a consensus on spaces (4 spaces per tab key). And
> >>there are lots of pros and cons to boths sides of the argument.
> >>
> >>
> >
> >
> >


 
 
Adam





PostPosted: Mon Sep 06 20:47:39 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority)


>
> I don't know what tab-user Adam's excellent SQL looks like in his own
> newsreader, but here's a recent example from the many that appear to
> have suffered from <tab> use (view it with a fixed-width font). Whether
> I read it in my newsreader, or through Google Groups, the lines are
> indented by 0, 20, 20, 16, and 0 spaces, respectively.

My SQL looks pretty bad in this newsreader (Outlook Express); it doesn't
recognize TABs imported from other editors (renders them as spaces), and I
agree, the stops are a bit odd. I use them anyway, because I'm in the habit
from editing in better editors all day... But I didn't think about anyone
reading with a fixed-pitch font. I'm using Times in the reader, so it
doesn't look TOO bad on this end.

Speaking of which, anyone who hasn't should consider giving Profont a
try:

http://www.tobias-jung.de/seekingprofont/

It's a truly excellent source code editing font.


 
 
Adam





PostPosted: Mon Sep 06 21:06:08 CDT 2004 Top

SQL Server Developer >> Anyone up for a religious war? (low priority)


> I agree. When I was heavy into Visual FoxPro programming I was dead set
> against using spaces and always preferred tabs. That is because I always
> used the VFP editor and it always looked the same. Now with TSQL I can't
> imagine using anything other than spaces since there are so many tools and
> ways to view the code. So many times I audit clients and have to weed
> through code with tabs that is so poorly formatted it hurts.

That's how I feel about spaces :)

The real problem comes when people MIX spaces and tabs. If you use one
way or another, consistently, then any good editor should be able to rendor
the code somewhat well. The problem occurs when, e.g. one developer has the
tab key set to produce 4 spaces and another developer, has the tab stops set
at 4 spaces, but still using a tab character. Then some third party, such
as you, comes along with an editor set to render tab characters as 8 spaces
and everything looks horrible.