lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: cvs commit: jakarta-lucene/src/java/org/apache/lucene/search
Date Sat, 13 Sep 2003 23:17:12 GMT
Doug - points well taken and I'll revert my indentation changes.

I also choose to adhere to the 80-column rule as well (at least I try -  
not sure if I have IDEA set up to enforce it).

The missing curly brackets on one-line if/while type things is risky  
though - it is easy to think you're adding something to an if clause  
formatted like that by simply indenting and not noticing that you need  
to put curly brackets (although test cases should catch this type of  
thing :).

My apologies for jumping the gun on this.... I violated the first rule  
in my favorite style guide, The Elements of Java Style - "Adhere to the  
style of the original".  Thanks for your time on this topic.


On Saturday, September 13, 2003, at 05:11  PM, Doug Cutting wrote:

> I've said this stuff before:
> I indent things using two spaces.  I mostly adhere to Sun's style  
> guidelines.  However, there's a tension there between the  
> four-spaces-per-indent-level rule and the 80-columns rule.  Unlike  
> most Java programmers, I choose to obey the 80-column rule.  I edit in  
> an 80-column wide Emacs window, and don't like wrapped lines.   
> Indenting 2 spaces makes this workable.  I also just like the way  
> 2-space indenting looks.  Call me crazy and anti-social.
> We should be tolerant of other coding styles.  Lots of folks put  
> opening brackets on separate lines, prefix field names with  
> underscores or 'm', have 120 column lines, and other things that I  
> would never do.  I think it is rude to re-indent or otherwise re-style  
> a whole file, unless it is unlikely that the original author will ever  
> edit it again.  I think it is polite, if you make a one or two line  
> change, to make it in the file's existing style.  For larger changes,  
> say ten lines or so, I think it is fine to use a different style than  
> that used in the rest of the file.  If you do a major re-write, then  
> re-indenting is fine.  Styles, like accents in spoken language, give  
> code character.  There is no univerally acceptable style.  Unless  
> something is unintelligable, we needn't re-state it.
> Doug
> Erik Hatcher wrote:
>> On Saturday, September 13, 2003, at 06:46  AM,  
>> wrote:
>>>   Reformatted.  Do we have any style guides special to Lucene  
>>> different than Jakarta standards?
>> I'm doing some thorough looks at Lucene's source code and its helpful  
>> to me to reformat the files with 4 space indents rather than the  
>> usual 2 I see.  Are there specific style guidelines Lucene is  
>> following in contrast to the semi-official Jakarta ones?
>> Also, one-line blocks without curly brackets drives me nuts!  :)  Is  
>> it ok for me to put them around statements like this:
>>     if (condition)
>>         doSomething();
>> ??
>> I went ahead and did reformatting to a couple of files, and I'm not  
>> planning on doing it globally, but just as I encounter them.  I  
>> wanted to check on this before potentially doing others similarly.
>>     Erik
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message