lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: patch - DEFAULT_ vars in IndexWriter non-final and DEFAULT for useCompoundFile
Date Mon, 28 Feb 2005 22:42:27 GMT
Kevin A. Burton wrote:
> Doug Cutting wrote:
> 
>> Wolf Siberski wrote:
>>
>>> So, if anything at all, I would rather opt for making these constants
>>> private :-).
>>
>>
>>
>> I agree.  In general, fields should either be final, or private with 
>> accessor methods.  So, we could change this to:
>>
>> private static int defaultMergeFactor =
>>   Integer.parseInt(System.getProperty("org.apache.lucene.mergeFactor",
>>                                       "10"));
>>
>> public static int getDefaultMergeFactor() {
>>   return mergeFactor;
>> }
>>
>> public static void setDefaultMergeFactor(int mergeFactor) {
>>   defaultMergeFactor = mergeFactor;
>> }
> 
> 
> In my original patch I deleted 5 "final" keywords for a reduction in 
> code of 25 bytes..   If I were to submit the patch again I'd have to add 
> 2 methods and 35 additional lines of code.
> 
> Seems to me that the Java coding conventions in this situation should be 
> ignored.

This isn't a coding convention, but rather software engineering.  If we 
wish to be able to back-compatibly modify Lucene's implementation at a 
later date, its usually easiest to have access through methods rather 
than fields, since we can intecept reads and writes to the field.

Doug

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message