You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Kathey Marsden <km...@sbcglobal.net> on 2006/05/31 16:12:19 UTC
Code formatting debate, confusion and wasted time , Has it gone on
long enough?
In a comment in DERBY-1302 Knut Anders said ....
>If we want to reindent large parts of the code, I think we should do
>it sometime after 10.1.3 is released and before the 10.2 branch is
>created, and we should try to use a style that is used elsewhere in
>the code (I prefer tab-free code myself).
Perhaps we have all lived in the code formatting "Tower of Babel" long
enough. I think code formatting like language doesn't matter as long as
everyone understands it and it is consistent. I would like to propose
that we:
1) Choose and document a format.
I think everyone can agree to get rid of the tabs. Otherwise ...
The volunteer doing the work gets to propose the format and only
very serious objections should be raised
in the interest of getting this done. Some Apache examples
are at:
http://jakarta.apache.org/site/faqs.html#Coding%20Conventions%20and%20Standards
2) Set a date six weeks out from the completion of the code formatting
documentation for the reformat so folks can plan accordingly.
3) See if there are volunteers willing to determine the correct settings
for Eclipse, Net Beans and other IDE's.
4) On the reformatting date, reformat both the trunk and the 10.1 branch
so that fixes can be merged easily.
Extra credit, think about long term maintenance, checking, and
auto-formatting.
Does anyone have any objections to a plan like this? If not I will
create a Jira entry and subtasks. Anyone tired enough of this issue to
take on this task?
Kathey
http://en.wikipedia.org/wiki/Tower_of_Babel
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by "Bernt M. Johnsen" <Be...@Sun.COM>.
>>>>>>>>>>>> Rick Hillegas wrote (2006-05-31 13:25:09):
> [...] My tabs are configured at 4 space intervals. [...]
>>>>>>>>>>>> Rodrigo Madera wrote (2006-05-31 17:50:10):
> Hey, tabs are 8 spaces by nature.
>
> [...]
Hmmm..... I think this proves my point ;-)
--
Bernt Marius Johnsen, Database Technology Group,
Staff Engineer, Technical Lead Derby/Java DB
Sun Microsystems, Trondheim, Norway
Re: Code formatting debate, confusion and wasted time , Has it gone on long enough?
Posted by Rodrigo Madera <ro...@gmail.com>.
Hey, tabs are 8 spaces by nature.
I've always used tabs. I will never ever move to non-tabs in the
future for my projects.
There is no "logical" explanation for this other than personal taste.
I used Subversion and it has never complained about anything.
Talking about code style is like talking about soccer.
We all know who the best is, but everyone has it's favorite, so they
will hide/manipulate/favor the facts =o)
Rodrigo
On 5/31/06, Manish Khettry <ma...@yahoo.com> wrote:
> does it work well when the source is printed? why not
> just use spaces to indent instead of redefining a tab?
> I'm curious-- what do other apache projects say in
> this regard?
>
> Sorry, but I can't resist participating in religious
> debates :)
>
>
> --- Rick Hillegas <Ri...@Sun.COM> wrote:
>
> > Before injecting a massive singularity into our code
> > archaeology, I
> > would like to better understand the passionate
> > objection to tabs. Let me
> > explain my perspective: I use a crude, old-fashioned
> > editor called
> > emacs. My tabs are configured at 4 space intervals.
> > With this setting, I
> > almost never have a problem reading the existing
> > code. So who is having
> > problems and why? Do other people's IDEs silently
> > bulk reformat the
> > code? Can that behavior be disabled? Could we be
> > satisfied with the
> > following simple rules, which used to satisfy us
> > nine years ago:
> >
> > 1) Ladies and gentlemen, set your tabs to four
> > spaces.
> > 2) Don't bulk reformat other people's code.
> >
> > I hope we are not headed into a religious war.
> >
> > Regards,
> > -Rick
> >
> > Myrna van Lunteren wrote:
> >
> > > On 5/31/06, Rodrigo Madera
> > <ro...@gmail.com> wrote:
> > >
> > >> Why do you all hate tabs sooo much??
> > >>
> > >> On 5/31/06, Bernt M. Johnsen
> > <Be...@sun.com> wrote:
> > >> > I heartily agree. We definitely need an
> > enforced standard on
> > >> > this.
> > >
> > > [snip]
> > >
> > >> > And, we should definitely get rid of the tabs.
> > >> >
> > >> >
> > >
> > >
> > > I personally can happily accept whatever standard
> > is decided on, and
> > > I'll admit I like making tabs. :-)
> > >
> > > But, when looking at code, you cannot tell whether
> > you see tabs or
> > > spaces unless you actually scroll over the blank
> > bits with a cursor
> > > key...
> > >
> > > Also, in most editors tabs are configurable to
> > 'mean' (be represented)
> > > varying number of spaces, and thus, open to
> > interpretation. It gets
> > > even worse when you think of using IDEs - these
> > automatically create
> > > the idents for you based. Some tools will convert
> > tabs into spaces
> > > when you perform cut-and-paste...
> > >
> > > All in all, when working with a group of people,
> > it's easy to end up
> > > with a mishmash of tabs and spaces and especially
> > with having a mix of
> > > tabs and spaces on the same line is very
> > confusing.
> > >
> > > Settling on the non-configurable 'space' seems
> > cleanest.
> > >
> > > Myrna
> >
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
Re: Code formatting debate, confusion and wasted time , Has it gone
on long enough?
Posted by Kathey Marsden <km...@sbcglobal.net>.
Bernt M. Johnsen wrote:
> Therefore, any
>enforced standard would be welcomed by me.
>
>
>
This is the key point. I had thought there was consensus or at least
complacency about spaces in the tab/space debate but I was wrong. So I
will remove this statement from my proposal:
"I think everyone can agree to get rid of the tabs." Then I think
that we need to yield to whatever volunteer feels strongly enough about
this to do the work.
Kathey
1) Choose and document a format.
The volunteer doing the work gets to propose the format and only
very serious objections should be raised in the interest of getting
this done. Some Apache examples are at:
http://jakarta.apache.org/site/faqs.html#Coding%20Conventions%20and%20Standards
Note: Jeremy reformatted the client code shortly after contribution.
One possible standard might be to match what has already been done for
client. The problem is, that was never documented so needs to be
documented, but matching that could minimize code disruption and give us
a standard.
2) Set a date six weeks out from the completion of the code formatting
documentation for the reformat so folks can plan accordingly.
3) See if there are volunteers willing to determine the correct settings
for Eclipse, Net Beans, emacs, and other IDE's.
4) On the reformatting date, reformat both the trunk and the 10.1 branch
so that fixes can be merged easily.
Extra credit, think about long term maintenance, checking, and
auto-formatting.
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by Kristian Waagan <Kr...@Sun.COM>.
Rick Hillegas wrote:
> I would like to understand what code archaeology looks like after the
> Homogenizing Event. I think that this will split codeline time into two
> segments: Before Homogenization and After Homogenization. The
> Homogenizer will appear as the author of a lot of our code. In tracing
> the history of a file, you will have to cross-reference two subversion
> clients, one rolled back Before Homogenization and one set at the
> current level After Homogenization. Can this be simplified? Are there
> tools that zipper the two views together?
Since we operate with a comitter role, svn praise/annotate/blame is
already quite useless when it comes to the author name. You must consult
the log to figure out who has really written the code anyway.
Personally, I don't have any problems dealing with a split in the
revision history, as long as this split is well defined (i.e. all white
space changes done in a specific revision [range]). But I'm not a
committer, I suppose you guys are more affected by this.
As time goes by, the problem will be less and less prudent.
We managed the repos change and the huge "touch-a-lot-of-files" eol
patch committed earlier, didn't we?
Fianlly, things won't be easier if we postpone this clean-up operation...
I think doing this just before we branch 10.2 has been mentioned as a
suitable time, and also applying the changes to the 10.1 branch as well.
--
Kristian
>
> -Rick
>
> Bernt M. Johnsen wrote:
>
>>>>>>>>>>>>>> Rick Hillegas wrote (2006-05-31 13:25:09):
>>>>>>>>>>>>>>
>>> Before injecting a massive singularity into our code archaeology, I
>>> would like to better understand the passionate objection to tabs. Let
>>> me explain my perspective: I use a crude, old-fashioned editor called
>>> emacs. My tabs are configured at 4 space intervals. With this
>>> setting, I almost never have a problem reading the existing code. So
>>> who is having problems and why?
>>
>> 1) Some tools change code invisibly. E.g. Emacs will (at least in some
>> configurations) change from space to tabs or vice vers when you hit
>> the tab key.
>> 2) Tabstops set to 4, as you do, requires all tools working with Derby
>> to be identically set up. I guess that never will happen.
>> 3) Spaces are spaces and mey not be differently interpreted.
>>
>> I use Emasc too (best IDE there is!) and have configured Emacs to fill
>> with spaces when I hit the tab key.
>>
>>
>>
>>> Do other people's IDEs silently bulk reformat the code?
>>>
>>
>> It seems like some do.....
>>
>>
>>
>>> Can that behavior be disabled?
>>
>> Well. Difficult to say. We deal with Emacs, XEamacs, netbeans,
>> Eclipse, vi, and a host of other tools/editors here.
>>
>>
>>
>>> Could we be satisfied with the following simple rules, which used to
>>> satisfy us nine years ago:
>>>
>>> 1) Ladies and gentlemen, set your tabs to four spaces.
>>> 2) Don't bulk reformat other people's code.
>>>
>>> I hope we are not headed into a religious war.
>>>
>>
>> And: I don't hate tabs. But my nearly 30 years of programming have
>> taught me that spaces work better than tabs, but I can live with
>> both. What I dont *want* to live with (although I of course can), is
>> unnecessary white space changes when working with svn. Therefore, an
>> enforced standard would be welcomed by me.
>>
>>
>>
>>> [...]
>>>
>
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by Rick Hillegas <Ri...@Sun.COM>.
I would like to understand what code archaeology looks like after the
Homogenizing Event. I think that this will split codeline time into two
segments: Before Homogenization and After Homogenization. The
Homogenizer will appear as the author of a lot of our code. In tracing
the history of a file, you will have to cross-reference two subversion
clients, one rolled back Before Homogenization and one set at the
current level After Homogenization. Can this be simplified? Are there
tools that zipper the two views together?
-Rick
Bernt M. Johnsen wrote:
>>>>>>>>>>>>>Rick Hillegas wrote (2006-05-31 13:25:09):
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>Before injecting a massive singularity into our code archaeology, I
>>would like to better understand the passionate objection to tabs. Let me
>>explain my perspective: I use a crude, old-fashioned editor called
>>emacs. My tabs are configured at 4 space intervals. With this setting, I
>>almost never have a problem reading the existing code. So who is having
>>problems and why?
>>
>>
>
>1) Some tools change code invisibly. E.g. Emacs will (at least in some
> configurations) change from space to tabs or vice vers when you hit
> the tab key.
>2) Tabstops set to 4, as you do, requires all tools working with Derby
> to be identically set up. I guess that never will happen.
>3) Spaces are spaces and mey not be differently interpreted.
>
>I use Emasc too (best IDE there is!) and have configured Emacs to fill
>with spaces when I hit the tab key.
>
>
>
>>Do other people's IDEs silently bulk reformat the code?
>>
>>
>
>It seems like some do.....
>
>
>
>>Can that behavior be disabled?
>>
>>
>
>Well. Difficult to say. We deal with Emacs, XEamacs, netbeans,
>Eclipse, vi, and a host of other tools/editors here.
>
>
>
>>Could we be satisfied with the following simple rules, which used to
>>satisfy us nine years ago:
>>
>>1) Ladies and gentlemen, set your tabs to four spaces.
>>2) Don't bulk reformat other people's code.
>>
>>I hope we are not headed into a religious war.
>>
>>
>
>And: I don't hate tabs. But my nearly 30 years of programming have
>taught me that spaces work better than tabs, but I can live with
>both. What I dont *want* to live with (although I of course can), is
>unnecessary white space changes when working with svn. Therefore, an
>enforced standard would be welcomed by me.
>
>
>
>>[...]
>>
>>
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by "Bernt M. Johnsen" <Be...@Sun.COM>.
>>>>>>>>>>>> Rick Hillegas wrote (2006-05-31 13:25:09):
> Before injecting a massive singularity into our code archaeology, I
> would like to better understand the passionate objection to tabs. Let me
> explain my perspective: I use a crude, old-fashioned editor called
> emacs. My tabs are configured at 4 space intervals. With this setting, I
> almost never have a problem reading the existing code. So who is having
> problems and why?
1) Some tools change code invisibly. E.g. Emacs will (at least in some
configurations) change from space to tabs or vice vers when you hit
the tab key.
2) Tabstops set to 4, as you do, requires all tools working with Derby
to be identically set up. I guess that never will happen.
3) Spaces are spaces and mey not be differently interpreted.
I use Emasc too (best IDE there is!) and have configured Emacs to fill
with spaces when I hit the tab key.
> Do other people's IDEs silently bulk reformat the code?
It seems like some do.....
> Can that behavior be disabled?
Well. Difficult to say. We deal with Emacs, XEamacs, netbeans,
Eclipse, vi, and a host of other tools/editors here.
> Could we be satisfied with the following simple rules, which used to
> satisfy us nine years ago:
>
> 1) Ladies and gentlemen, set your tabs to four spaces.
> 2) Don't bulk reformat other people's code.
>
> I hope we are not headed into a religious war.
And: I don't hate tabs. But my nearly 30 years of programming have
taught me that spaces work better than tabs, but I can live with
both. What I dont *want* to live with (although I of course can), is
unnecessary white space changes when working with svn. Therefore, an
enforced standard would be welcomed by me.
> [...]
--
Bernt Marius Johnsen, Database Technology Group,
Staff Engineer, Technical Lead Derby/Java DB
Sun Microsystems, Trondheim, Norway
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by David Van Couvering <Da...@Sun.COM>.
I meant: all new code should use *spaces*, sorry.
David
David Van Couvering wrote:
> I have been doing fine setting my editor to have tab stops at 4 spaces.
> Then I indent with spaces not tabs. It's never bothered me (that much).
>
> I vote for agreeing on a level of indent (e.g. 4 spaces) and keep it at
> that. All new code should use tabs, and all old code with tabs is
> grandfathered in. I'm not sure about doing a massive reformat, I have
> to think about that.
>
> I'd rather us spend time on fixing things like methods 500 lines long
> that have so many nested depths of logic that you only have eight
> columns of space available per line.
>
> David
>
>
> Andreas Korneliussen wrote:
>> Rick Hillegas wrote:
>>> Before injecting a massive singularity into our code archaeology, I
>>> would like to better understand the passionate objection to tabs. Let
>>> me explain my perspective: I use a crude, old-fashioned editor called
>>> emacs. My tabs are configured at 4 space intervals. With this
>>> setting, I almost never have a problem reading the existing code. So
>>> who is having problems and why? Do other people's IDEs silently bulk
>>> reformat the
>>
>> Some files, which have a mix of tabs and spaces, can sometimes become
>> rather unreadable.
>>
>>> code? Can that behavior be disabled? Could we be satisfied with the
>>> following simple rules, which used to satisfy us nine years ago:
>>>
>>> 1) Ladies and gentlemen, set your tabs to four spaces.
>>> 2) Don't bulk reformat other people's code.
>>>
>>
>> I do not think that is enough, since it does not deal with the problem
>> of files which have a mix of tabs and spaces.
>>
>> You could add:
>>
>> 3) A file should be consistent in its use of spaces vs. tabs. If a
>> file uses spaces for indentation, no tabs are allowed into that file.
>>
>> The problem with rule 3, is of course that developers need to set up
>> their tools based on which file they are modifying. It is easier if
>> all files have the same indentation-style. Therefore I support getting
>> a well-defined code-format in Derby.
>>
>> -- Andreas
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by David Van Couvering <Da...@Sun.COM>.
I have been doing fine setting my editor to have tab stops at 4 spaces.
Then I indent with spaces not tabs. It's never bothered me (that much).
I vote for agreeing on a level of indent (e.g. 4 spaces) and keep it at
that. All new code should use tabs, and all old code with tabs is
grandfathered in. I'm not sure about doing a massive reformat, I have
to think about that.
I'd rather us spend time on fixing things like methods 500 lines long
that have so many nested depths of logic that you only have eight
columns of space available per line.
David
Andreas Korneliussen wrote:
> Rick Hillegas wrote:
>> Before injecting a massive singularity into our code archaeology, I
>> would like to better understand the passionate objection to tabs. Let
>> me explain my perspective: I use a crude, old-fashioned editor called
>> emacs. My tabs are configured at 4 space intervals. With this setting,
>> I almost never have a problem reading the existing code. So who is
>> having problems and why? Do other people's IDEs silently bulk reformat
>> the
>
> Some files, which have a mix of tabs and spaces, can sometimes become
> rather unreadable.
>
>> code? Can that behavior be disabled? Could we be satisfied with the
>> following simple rules, which used to satisfy us nine years ago:
>>
>> 1) Ladies and gentlemen, set your tabs to four spaces.
>> 2) Don't bulk reformat other people's code.
>>
>
> I do not think that is enough, since it does not deal with the problem
> of files which have a mix of tabs and spaces.
>
> You could add:
>
> 3) A file should be consistent in its use of spaces vs. tabs. If a file
> uses spaces for indentation, no tabs are allowed into that file.
>
> The problem with rule 3, is of course that developers need to set up
> their tools based on which file they are modifying. It is easier if all
> files have the same indentation-style. Therefore I support getting a
> well-defined code-format in Derby.
>
> -- Andreas
Re: Code formatting debate, confusion and wasted time , Has it gone
on long enough?
Posted by Kathey Marsden <km...@sbcglobal.net>.
James Maes - Materialogic Programmer wrote:
>I've had to draft several somewhat formal coding standards for different
>projects / companies and would be more than happy to throw one out there
>as a starting point.
>
>It covers most things and a few others as well.
>
>
>
Thanks James for volunteering!
I think there are three options here:
1) Match and document the client code format that Jeremy said he used
when reformatting after the client contribution:
http://www.nabble.com/Re%3A+Reformat+client+code--p9229.html
( my vote based on simplicity, laziness, precedent and the fact that
most IDE's can easily adapt and often do default to the Sun conventions).
For this you would just need to verify that there are no other
variations in client and then wordsmith the text for the website. (I
reformatted the client code in Eclipse to the defaults, at first glance
I only saw line length diffs. Lines should be limited to 80 characters
according to the Sun conventions and is a good change I think)
2) Adopt one of the other Apache project variations which might seem
"better" in some way. For example:
http://jakarta.apache.org/site/faqs.html#Coding%20Conventions%20and%20Standards
3) Something completely different. (not so keen on this myself)
>I'm sure that when burned, it will create flames at least hot enough to
>make me run screaming back into lurkersville.
>
>
You can keep your feet out of the fire by attaching your proposal to
1363 as an option for consideration by whomever takes on that task. If
you like warm feet you can assign yourself to 1363 and post a website
patch which will give folks the opportunity to veto.
Kathey
Re: Code formatting debate, confusion and wasted time , Has it gone
on long enough?
Posted by James Maes - Materialogic Programmer <jm...@materialogic.com>.
As just a lurker on the list, I'm not sure that I should even offer
anything here, but what's the fun unless you have your poker in the
coals....
I'll avoid throwing any weight (i have none, remember the lurker
status) behind one coding style or the other (TABS must DIE [note, this
doesn't count as weight in any form due to the aforementioned avoidance
clause]), but I do have something that might help (other than :set et<cr>
:set ts=4).
I've had to draft several somewhat formal coding standards for different
projects / companies and would be more than happy to throw one out there
as a starting point.
It covers most things and a few others as well.
I'm sure that when burned, it will create flames at least hot enough to
make me run screaming back into lurkersville.
If interested, I would be happy to post a version of it in all the
needed formats.
Also, I am well aware that anything i find remotely funny is far from
anything that anyone else finds remotely funny(in case you found something
funny or something un-funny above [Note - I'm funny, everyone else
is troubled]), but I find hope for the others, as the great W.S.C said,
never, never, never quit (he drank enough
to kill a small donkey most days....)
-jm
On Thu, 1 Jun 2006, Dag H. Wanvik wrote:
> Andreas Korneliussen <An...@Sun.COM> writes:
>
> > 3) A file should be consistent in its use of spaces vs. tabs. If a
> > file uses spaces for indentation, no tabs are allowed into that file.
> >
> > The problem with rule 3, is of course that developers need to set up
> > their tools based on which file they are modifying. It is easier if
> > all files have the same indentation-style. Therefore I support getting
> > a well-defined code-format in Derby.
>
> +1
>
> I support that should agree on a standard for whitespace, I am tired
> of the current situation.
>
> My vote would be for spaces rather than tabs (most editors, and IDEs
> can be persuaded to do that), for the reasons quoted by Bernt and
> Andreas and others. It is also easy to enforce/check for committers.
>
> I would also vote for keeping 4 as the normal indentation amount,
> although I consider that less important than the tabs vs whitespace
> decision.
>
> As for the concerns of inconvenient historic blame/praise information
> (before homogenization and after), I think this is the price we will
> have to pay sooner or later. I also think Kathey's suggestion of a big
> bang makes sense (lesser evil compared to piece-meal conversions).
>
> A coding standard for code layout will get my support as well. I am
> happy to work with any style as long as it is consistent, but it is
> just that much easier to be consistent when changing someone else's
> code if we have one common standard, in stead of one per developer.
>
> Dag
>
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by "Dag H. Wanvik" <Da...@Sun.COM>.
Andreas Korneliussen <An...@Sun.COM> writes:
> 3) A file should be consistent in its use of spaces vs. tabs. If a
> file uses spaces for indentation, no tabs are allowed into that file.
>
> The problem with rule 3, is of course that developers need to set up
> their tools based on which file they are modifying. It is easier if
> all files have the same indentation-style. Therefore I support getting
> a well-defined code-format in Derby.
+1
I support that should agree on a standard for whitespace, I am tired
of the current situation.
My vote would be for spaces rather than tabs (most editors, and IDEs
can be persuaded to do that), for the reasons quoted by Bernt and
Andreas and others. It is also easy to enforce/check for committers.
I would also vote for keeping 4 as the normal indentation amount,
although I consider that less important than the tabs vs whitespace
decision.
As for the concerns of inconvenient historic blame/praise information
(before homogenization and after), I think this is the price we will
have to pay sooner or later. I also think Kathey's suggestion of a big
bang makes sense (lesser evil compared to piece-meal conversions).
A coding standard for code layout will get my support as well. I am
happy to work with any style as long as it is consistent, but it is
just that much easier to be consistent when changing someone else's
code if we have one common standard, in stead of one per developer.
Dag
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by Dy...@Sun.COM.
Rodrigo Madera <ro...@gmail.com> writes:
> So you vote on spaces or tabs anyway?
Spaces. But I think we have to live with both styles and mixed style
(shrug) for quite some time...
> On 6/9/06, Dyre.Tjeldvoll@sun.com <Dy...@sun.com> wrote:
>> Rodrigo Madera <ro...@gmail.com> writes:
>>
>> > One thing there is to learn from all this: Set standards BEFORE the
>> > project starts.
>>
>> Actually, it is not that simple. Derby opted to follow Sun's java
>> guidline which, believe it or not, says that if tabs are used, then the
>> tabwidth should be 4. Which, of course, is utterly brain-dead.
I'm told that this is no longer true, and maybe it was never intended,
but think that at some point this guideline could be _interpreted_ as
recommending tabwidth=4.
I understand that the rephrased guideline allows either tabs or
spaces, requires the indent level to be 4 spaces and tabwidth=8. Which
I find much more reasonable.
--
dt
Re: Code formatting debate, confusion and wasted time , Has it gone on long enough?
Posted by Rodrigo Madera <ro...@gmail.com>.
So you vote on spaces or tabs anyway?
On 6/9/06, Dyre.Tjeldvoll@sun.com <Dy...@sun.com> wrote:
> Rodrigo Madera <ro...@gmail.com> writes:
>
> > One thing there is to learn from all this: Set standards BEFORE the
> > project starts.
>
> Actually, it is not that simple. Derby opted to follow Sun's java
> guidline which, believe it or not, says that if tabs are used, then the
> tabwidth should be 4. Which, of course, is utterly brain-dead.
>
> It would have been much less painful to introduce space indentation
> gradually if the tabwidth had been 8, because then tab and space
> indentation could have coexisted in a file without making the file
> unreadable in most tools.
>
> A file that is consistently indented with tabs and tabwidth=4, is
> better, but not much. Using tools like cat, less, diff (even svn
> diff), or a2ps is a pain because every line appears wrapped and is
> hard to read... (yes, I'm one of those old fools that refuse to live
> my life inside an IDE).
>
> But files with both indentation styles is, by far, the worst. I'm so
> tired of scanning my patches for places where I have accidently
> tab-indented a line in a method that's space-indented, or vice
> versa. This is perhaps not the most important issue in Derby, but I
> think it really cuts the "joy of development" factor for Derby. And
> that's not good for an open source project...
>
> --
> dt
>
>
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by Dy...@Sun.COM.
Rodrigo Madera <ro...@gmail.com> writes:
> One thing there is to learn from all this: Set standards BEFORE the
> project starts.
Actually, it is not that simple. Derby opted to follow Sun's java
guidline which, believe it or not, says that if tabs are used, then the
tabwidth should be 4. Which, of course, is utterly brain-dead.
It would have been much less painful to introduce space indentation
gradually if the tabwidth had been 8, because then tab and space
indentation could have coexisted in a file without making the file
unreadable in most tools.
A file that is consistently indented with tabs and tabwidth=4, is
better, but not much. Using tools like cat, less, diff (even svn
diff), or a2ps is a pain because every line appears wrapped and is
hard to read... (yes, I'm one of those old fools that refuse to live
my life inside an IDE).
But files with both indentation styles is, by far, the worst. I'm so
tired of scanning my patches for places where I have accidently
tab-indented a line in a method that's space-indented, or vice
versa. This is perhaps not the most important issue in Derby, but I
think it really cuts the "joy of development" factor for Derby. And
that's not good for an open source project...
--
dt
Re: Code formatting debate, confusion and wasted time , Has it gone on long enough?
Posted by Rodrigo Madera <ro...@gmail.com>.
One thing there is to learn from all this: Set standards BEFORE the
project starts.
I'm really scared of the consequences of losing blame/praise
information. It's like erasing our parents...
Yeah... I will never start a project without having a written coding standard!!
Rodrigo
On 5/31/06, Andreas Korneliussen <an...@sun.com> wrote:
> Rick Hillegas wrote:
> > Before injecting a massive singularity into our code archaeology, I
> > would like to better understand the passionate objection to tabs. Let me
> > explain my perspective: I use a crude, old-fashioned editor called
> > emacs. My tabs are configured at 4 space intervals. With this setting, I
> > almost never have a problem reading the existing code. So who is having
> > problems and why? Do other people's IDEs silently bulk reformat the
>
> Some files, which have a mix of tabs and spaces, can sometimes become
> rather unreadable.
>
> > code? Can that behavior be disabled? Could we be satisfied with the
> > following simple rules, which used to satisfy us nine years ago:
> >
> > 1) Ladies and gentlemen, set your tabs to four spaces.
> > 2) Don't bulk reformat other people's code.
> >
>
> I do not think that is enough, since it does not deal with the problem
> of files which have a mix of tabs and spaces.
>
> You could add:
>
> 3) A file should be consistent in its use of spaces vs. tabs. If a file
> uses spaces for indentation, no tabs are allowed into that file.
>
> The problem with rule 3, is of course that developers need to set up
> their tools based on which file they are modifying. It is easier if all
> files have the same indentation-style. Therefore I support getting a
> well-defined code-format in Derby.
>
> -- Andreas
>
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by Andreas Korneliussen <an...@sun.com>.
Rick Hillegas wrote:
> Before injecting a massive singularity into our code archaeology, I
> would like to better understand the passionate objection to tabs. Let me
> explain my perspective: I use a crude, old-fashioned editor called
> emacs. My tabs are configured at 4 space intervals. With this setting, I
> almost never have a problem reading the existing code. So who is having
> problems and why? Do other people's IDEs silently bulk reformat the
Some files, which have a mix of tabs and spaces, can sometimes become
rather unreadable.
> code? Can that behavior be disabled? Could we be satisfied with the
> following simple rules, which used to satisfy us nine years ago:
>
> 1) Ladies and gentlemen, set your tabs to four spaces.
> 2) Don't bulk reformat other people's code.
>
I do not think that is enough, since it does not deal with the problem
of files which have a mix of tabs and spaces.
You could add:
3) A file should be consistent in its use of spaces vs. tabs. If a file
uses spaces for indentation, no tabs are allowed into that file.
The problem with rule 3, is of course that developers need to set up
their tools based on which file they are modifying. It is easier if all
files have the same indentation-style. Therefore I support getting a
well-defined code-format in Derby.
-- Andreas
Re: Code formatting debate, confusion and wasted time , Has it gone on long enough?
Posted by Manish Khettry <ma...@yahoo.com>.
does it work well when the source is printed? why not
just use spaces to indent instead of redefining a tab?
I'm curious-- what do other apache projects say in
this regard?
Sorry, but I can't resist participating in religious
debates :)
--- Rick Hillegas <Ri...@Sun.COM> wrote:
> Before injecting a massive singularity into our code
> archaeology, I
> would like to better understand the passionate
> objection to tabs. Let me
> explain my perspective: I use a crude, old-fashioned
> editor called
> emacs. My tabs are configured at 4 space intervals.
> With this setting, I
> almost never have a problem reading the existing
> code. So who is having
> problems and why? Do other people's IDEs silently
> bulk reformat the
> code? Can that behavior be disabled? Could we be
> satisfied with the
> following simple rules, which used to satisfy us
> nine years ago:
>
> 1) Ladies and gentlemen, set your tabs to four
> spaces.
> 2) Don't bulk reformat other people's code.
>
> I hope we are not headed into a religious war.
>
> Regards,
> -Rick
>
> Myrna van Lunteren wrote:
>
> > On 5/31/06, Rodrigo Madera
> <ro...@gmail.com> wrote:
> >
> >> Why do you all hate tabs sooo much??
> >>
> >> On 5/31/06, Bernt M. Johnsen
> <Be...@sun.com> wrote:
> >> > I heartily agree. We definitely need an
> enforced standard on
> >> > this.
> >
> > [snip]
> >
> >> > And, we should definitely get rid of the tabs.
> >> >
> >> >
> >
> >
> > I personally can happily accept whatever standard
> is decided on, and
> > I'll admit I like making tabs. :-)
> >
> > But, when looking at code, you cannot tell whether
> you see tabs or
> > spaces unless you actually scroll over the blank
> bits with a cursor
> > key...
> >
> > Also, in most editors tabs are configurable to
> 'mean' (be represented)
> > varying number of spaces, and thus, open to
> interpretation. It gets
> > even worse when you think of using IDEs - these
> automatically create
> > the idents for you based. Some tools will convert
> tabs into spaces
> > when you perform cut-and-paste...
> >
> > All in all, when working with a group of people,
> it's easy to end up
> > with a mishmash of tabs and spaces and especially
> with having a mix of
> > tabs and spaces on the same line is very
> confusing.
> >
> > Settling on the non-configurable 'space' seems
> cleanest.
> >
> > Myrna
>
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by Rick Hillegas <Ri...@Sun.COM>.
Before injecting a massive singularity into our code archaeology, I
would like to better understand the passionate objection to tabs. Let me
explain my perspective: I use a crude, old-fashioned editor called
emacs. My tabs are configured at 4 space intervals. With this setting, I
almost never have a problem reading the existing code. So who is having
problems and why? Do other people's IDEs silently bulk reformat the
code? Can that behavior be disabled? Could we be satisfied with the
following simple rules, which used to satisfy us nine years ago:
1) Ladies and gentlemen, set your tabs to four spaces.
2) Don't bulk reformat other people's code.
I hope we are not headed into a religious war.
Regards,
-Rick
Myrna van Lunteren wrote:
> On 5/31/06, Rodrigo Madera <ro...@gmail.com> wrote:
>
>> Why do you all hate tabs sooo much??
>>
>> On 5/31/06, Bernt M. Johnsen <Be...@sun.com> wrote:
>> > I heartily agree. We definitely need an enforced standard on
>> > this.
>
> [snip]
>
>> > And, we should definitely get rid of the tabs.
>> >
>> >
>
>
> I personally can happily accept whatever standard is decided on, and
> I'll admit I like making tabs. :-)
>
> But, when looking at code, you cannot tell whether you see tabs or
> spaces unless you actually scroll over the blank bits with a cursor
> key...
>
> Also, in most editors tabs are configurable to 'mean' (be represented)
> varying number of spaces, and thus, open to interpretation. It gets
> even worse when you think of using IDEs - these automatically create
> the idents for you based. Some tools will convert tabs into spaces
> when you perform cut-and-paste...
>
> All in all, when working with a group of people, it's easy to end up
> with a mishmash of tabs and spaces and especially with having a mix of
> tabs and spaces on the same line is very confusing.
>
> Settling on the non-configurable 'space' seems cleanest.
>
> Myrna
Re: Code formatting debate, confusion and wasted time , Has it gone on long enough?
Posted by Myrna van Lunteren <m....@gmail.com>.
On 5/31/06, Rodrigo Madera <ro...@gmail.com> wrote:
> Why do you all hate tabs sooo much??
>
> On 5/31/06, Bernt M. Johnsen <Be...@sun.com> wrote:
> > I heartily agree. We definitely need an enforced standard on
> > this.
[snip]
> > And, we should definitely get rid of the tabs.
> >
> >
I personally can happily accept whatever standard is decided on, and
I'll admit I like making tabs. :-)
But, when looking at code, you cannot tell whether you see tabs or
spaces unless you actually scroll over the blank bits with a cursor
key...
Also, in most editors tabs are configurable to 'mean' (be represented)
varying number of spaces, and thus, open to interpretation. It gets
even worse when you think of using IDEs - these automatically create
the idents for you based. Some tools will convert tabs into spaces
when you perform cut-and-paste...
All in all, when working with a group of people, it's easy to end up
with a mishmash of tabs and spaces and especially with having a mix of
tabs and spaces on the same line is very confusing.
Settling on the non-configurable 'space' seems cleanest.
Myrna
Re: Code formatting debate, confusion and wasted time , Has it gone on long enough?
Posted by Rodrigo Madera <ro...@gmail.com>.
Why do you all hate tabs sooo much??
On 5/31/06, Bernt M. Johnsen <Be...@sun.com> wrote:
> I heartily agree. We definitely need an enforced standard on
> this. Personally, I don't care very much about coding style (whether
> the "{"'s are placed on separate lines or not, whether a function is
> falled "foo()" or "foo ()" etc). But I do very much care about
> whitespace problems when dealing with tools like cvs and svn.
>
> And, we should definitely get rid of the tabs.
>
>
> >>>>>>>>>>>> Kathey Marsden wrote (2006-05-31 07:12:19):
> > In a comment in DERBY-1302 Knut Anders said ....
> > >If we want to reindent large parts of the code, I think we should do
> > >it sometime after 10.1.3 is released and before the 10.2 branch is
> > >created, and we should try to use a style that is used elsewhere in
> > >the code (I prefer tab-free code myself).
> >
> > Perhaps we have all lived in the code formatting "Tower of Babel" long
> > enough. I think code formatting like language doesn't matter as long as
> > everyone understands it and it is consistent. I would like to propose
> > that we:
> >
> > 1) Choose and document a format.
> > I think everyone can agree to get rid of the tabs. Otherwise ...
> > The volunteer doing the work gets to propose the format and only
> > very serious objections should be raised
> > in the interest of getting this done. Some Apache examples
> > are at:
> >
> > http://jakarta.apache.org/site/faqs.html#Coding%20Conventions%20and%20Standards
> > 2) Set a date six weeks out from the completion of the code formatting
> > documentation for the reformat so folks can plan accordingly.
> > 3) See if there are volunteers willing to determine the correct settings
> > for Eclipse, Net Beans and other IDE's.
> > 4) On the reformatting date, reformat both the trunk and the 10.1 branch
> > so that fixes can be merged easily.
> >
> > Extra credit, think about long term maintenance, checking, and
> > auto-formatting.
> >
> > Does anyone have any objections to a plan like this? If not I will
> > create a Jira entry and subtasks. Anyone tired enough of this issue to
> > take on this task?
> >
> > Kathey
> >
> > http://en.wikipedia.org/wiki/Tower_of_Babel
> >
> >
>
> --
> Bernt Marius Johnsen, Database Technology Group,
> Staff Engineer, Technical Lead Derby/Java DB
> Sun Microsystems, Trondheim, Norway
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
>
> iD8DBQFEfewOlFBD9TXBAPARAh5SAJ4zUtjC7sSAt8o9bPvpCXb2MsNBTgCcDgZ6
> CdT+TtCYRivcSxx85y642IA=
> =02r0
> -----END PGP SIGNATURE-----
>
>
>
Re: Code formatting debate, confusion and wasted time ,
Has it gone on long enough?
Posted by "Bernt M. Johnsen" <Be...@Sun.COM>.
I heartily agree. We definitely need an enforced standard on
this. Personally, I don't care very much about coding style (whether
the "{"'s are placed on separate lines or not, whether a function is
falled "foo()" or "foo ()" etc). But I do very much care about
whitespace problems when dealing with tools like cvs and svn.
And, we should definitely get rid of the tabs.
>>>>>>>>>>>> Kathey Marsden wrote (2006-05-31 07:12:19):
> In a comment in DERBY-1302 Knut Anders said ....
> >If we want to reindent large parts of the code, I think we should do
> >it sometime after 10.1.3 is released and before the 10.2 branch is
> >created, and we should try to use a style that is used elsewhere in
> >the code (I prefer tab-free code myself).
>
> Perhaps we have all lived in the code formatting "Tower of Babel" long
> enough. I think code formatting like language doesn't matter as long as
> everyone understands it and it is consistent. I would like to propose
> that we:
>
> 1) Choose and document a format.
> I think everyone can agree to get rid of the tabs. Otherwise ...
> The volunteer doing the work gets to propose the format and only
> very serious objections should be raised
> in the interest of getting this done. Some Apache examples
> are at:
>
> http://jakarta.apache.org/site/faqs.html#Coding%20Conventions%20and%20Standards
> 2) Set a date six weeks out from the completion of the code formatting
> documentation for the reformat so folks can plan accordingly.
> 3) See if there are volunteers willing to determine the correct settings
> for Eclipse, Net Beans and other IDE's.
> 4) On the reformatting date, reformat both the trunk and the 10.1 branch
> so that fixes can be merged easily.
>
> Extra credit, think about long term maintenance, checking, and
> auto-formatting.
>
> Does anyone have any objections to a plan like this? If not I will
> create a Jira entry and subtasks. Anyone tired enough of this issue to
> take on this task?
>
> Kathey
>
> http://en.wikipedia.org/wiki/Tower_of_Babel
>
>
--
Bernt Marius Johnsen, Database Technology Group,
Staff Engineer, Technical Lead Derby/Java DB
Sun Microsystems, Trondheim, Norway
Re: Code formatting debate, confusion and wasted time , Has it gone
on long enough?
Posted by "Jean T. Anderson" <jt...@bristowhill.com>.
Kathey Marsden wrote:
...
> 1) Choose and document a format. I think everyone can agree to get
> rid of the tabs. Otherwise ...
> The volunteer doing the work gets to propose the format and only
> very serious objections should be raised
> in the interest of getting this done. Some Apache examples
> are at:
>
> http://jakarta.apache.org/site/faqs.html#Coding%20Conventions%20and%20Standards
also the Apache DB guidelines are at http://db.apache.org/source.html:
> All Java Language source code in the repository must be written in conformance to the " Code Conventions for the Java Programming Language as published by Sun, or in conformance with another well-defined convention specified by the subproject.
The main thing is to settle on a "well-defined convention".
-jean