ofbiz-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen van der Wal <jvander...@stromboli.it>
Subject Re: Tabs to 4 spaces
Date Fri, 23 Jan 2009 09:07:45 GMT
Sorry for my late response, I've been away from a pc for a couple of days.
We've had debates about tabs versus spaces several times and this quote
reflects my opinion:

"The debate over whether to use tab characters or spaces for indenting code
is probably as old as Fortran. In fact, the arguing over this topic has led
to many a newsgroup and mailing-list flame war, many whose intensity far
surpass any Saturday night Quake Area session your thirteen brother ever
saw.
Well, I'm here to set the record straight on why tabs are a better choice.
Like good object oriented design, it's simply a matter of recognizing the
correct abstractions and encapsulating them appropriately...

A tab in this context represents a unit of indentation, which should be
separate from the "physical" size of the representation of that unit (on the
screen). I happen to set all my editors to render that unit as equivalent to
4 spaces on the screen (even though the file only knows there is one unit of
indentation, the tab character), but you may set your editor to render it as
2, 4, 8, or 100 spaces - whatever floats your boat. Point is, I don't care
how big you want the indentation unit to be, and you shouldn't have to care
how big I want(ed) it either. Any decent editor will let you control how
tabs are rendered, and should preserve them in the file regardless of how
they were rendered on the screen.

By always using tabs, my code always looks consistent when I write it and
you can always make it the indentation as big or small you want it. What is
important to the notion of a "unit of indentation" is not the size of the
indents, but rather the position of statements relative to each other. Using
tabs all the time preserves that property, but using spaces unnecessarily
merges the notion of your or my particular visual choice with the notion of
relative positioning.

The more important effect of using tabs is that we abstract out the "unit of
indentation" and each implement it with whatever number of "simulated"
spaces we prefer. Later, if I decide my indentation unit rendering is not
the right size for me, I don't have to go change a bunch of existing code to
be consistent nor do you have to even know I changed my mind.
Now, isn't that beautiful? I wish everyone would see this and quit using
spaces to indent code and, more generally, trying to make coding standards
that specify such a "personal preference" kind of thing.""

So is this patch really worth the trouble?

-Jeroen


On Thu, Jan 22, 2009 at 8:08 AM, Jacques Le Roux <
jacques.le.roux@les7arts.com> wrote:

> If nobody disagree I will do that tomorrow. It will be a massive no
> functionnal change.
>
>
> Jacques
>
> From: "Jacques Le Roux" <jacques.le.roux@les7arts.com>
>
>> I will eventually do that later when the BigDecimal branch will have been
>> merged
>>
>> Jacques
>>
>> From: "Jacques Le Roux" <jacques.le.roux@les7arts.com>
>>
>>> If nobody complains, I will replace *all* tabs by 4 spaces in some days.
>>> It will be one sole big patch without any other changes
>>>
>>> Jacques
>>>
>>> From: "Stephen Rufle" <srufle@salmonllc.com>
>>>
>>>> +1
>>>> :)
>>>>
>>>> Jacques Le Roux wrote:
>>>>
>>>>> Currently there are 2351 tabs in Java files. We could easily replace
>>>>> all of them by 4 spaces. What do you think ?
>>>>>
>>>>> Maybe we could do the same in XML files, there are 32 786 tabs in
>>>>> them...
>>>>>
>>>>> In FreeMarker files : only 563 tabs, in Groovy only 668
>>>>>
>>>>> JavaScrip files have 242 088 of them, most js files come from
>>>>> outside...
>>>>>
>>>>> Thanks
>>>>>
>>>>> Jacques
>>>>>
>>>>>
>>>>
>>>>
>>>
>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message