You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Yonik Seeley <yo...@apache.org> on 2007/03/25 18:24:07 UTC
whitespace
On 3/25/07, Michael McCandless (JIRA) <ji...@apache.org> wrote:
> My first comment, which I fear will be the most controversial feedback
> here :), is a whitespace style question: I'm not really a fan of
> "cancerous whitespace" where every ( [ etc has its own whitespace
> around it.
>
> I generally prefer minimal whitespace within reason (ie as long as it
> does not heavily hurt readability). The thing is I don't know that
> Lucene has settled on this / if anyone else shares my opinion?
I don't like too much standardization on such things, but I admit that
all the whitespace around those parens hurts my eyes :-)
The java coding standards do say
"Spaces after keywords but no spaces either before or after
parentheses in method calls"
"if (a)" and "foo(a)"
-Yonik
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: whitespace
Posted by DM Smith <dm...@gmail.com>.
Just my 2 cents.
I think it is good to use tooling to establish a whitespace standard
for new files. For example, Eclipse has extensive formating and one
of the declared styles is Sun's. Checkstyle is also good at creating
a report of deviations from a defined standard. And it can be readily
be incorporated into an Ant build.
I have not found tooling that is sufficient for every case, so in
those cases, I think one should be deliberate in making the code more
readable.
For existing code, my preference is that changes follow the existing
style on a file by file basis and no gratuitous changes are made to
existing whitespace, thus minimizing patch changes.
Personally, it does not matter to me what the standard is, but I find
that consistency helps me understand the code more quickly.
With any kind of standard, especially the lack of one, I might use
tooling to put the code in the whitespace format I like, but before
making a patch, return it to what it was, again with tooling.
-- DM Smith
On Mar 25, 2007, at 12:24 PM, Yonik Seeley wrote:
> On 3/25/07, Michael McCandless (JIRA) <ji...@apache.org> wrote:
>> My first comment, which I fear will be the most controversial
>> feedback
>> here :), is a whitespace style question: I'm not really a fan of
>> "cancerous whitespace" where every ( [ etc has its own whitespace
>> around it.
>>
>> I generally prefer minimal whitespace within reason (ie as long as it
>> does not heavily hurt readability). The thing is I don't know that
>> Lucene has settled on this / if anyone else shares my opinion?
>
> I don't like too much standardization on such things, but I admit that
> all the whitespace around those parens hurts my eyes :-)
>
> The java coding standards do say
> "Spaces after keywords but no spaces either before or after
> parentheses in method calls"
>
> "if (a)" and "foo(a)"
>
> -Yonik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: whitespace
Posted by Doug Cutting <cu...@apache.org>.
Yonik Seeley wrote:
> The java coding standards do say
> "Spaces after keywords but no spaces either before or after
> parentheses in method calls"
>
> "if (a)" and "foo(a)"
Lucene's formatting guidelines are stated at:
http://wiki.apache.org/lucene-java/HowToContribute
In short, they say: Sun's conventions, *except* two-space indentation.
I think it is fair to bounce a patch for flagrantly violating these, or
to unilaterally repair its formatting prior to commit. It's painful to
re-format code after it is committed.
That's the current policy. It could be changed with a vote.
Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: whitespace
Posted by Chris Hostetter <ho...@fucit.org>.
: The java coding standards do say
: "Spaces after keywords but no spaces either before or after
: parentheses in method calls"
:
: "if (a)" and "foo(a)"
that's fairly readable in general, but i have found that when dealing with
complex conditionals, a little extra white space can make some things
standout that thta might otherwise be overlooked...
if (!(a||b)) vs if ( ! (a || b) )
while (foo(asdfasdfadsf) && bar(asdfasdfasdf) && (baz(asdfasdfadsf) || yak(23456))) {
vs...
while ( foo(asdfasdfadsf) &&
bar(asdfasdfasdf) &&
( baz(asdfasdfadsf) || yak(23456) ) ) {
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org