lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-3756) Don't allow IndexWriterConfig setters to chain
Date Thu, 09 Feb 2012 16:05:59 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-3756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13204606#comment-13204606
] 

Erick Erickson commented on LUCENE-3756:
----------------------------------------

+/- INFINITY.

Personally, these kinds of discussions are a monumental waste of time and energy. Not to mention
you can't avoid pissing people off no matter *what* is decided.

I'd rather get work out of *volunteers* than scare them off with this kind of discussion.
And it seems that code gets partitioned pretty much by default so the style starts to take
on the characteristics of the person doing the heavy lifting eventually anyway.

If someone's willing to put the time into writing the code, the least I can do is spend a
bit of time adjusting to the convention used. If I'm going to modify it, then I'll feel free
to make it more readable to *my* eyes. I happen to agree that chaining can be confusing. Tough.
I'll figure it out.

See Martin Fowler's excellent book "Refactoring". One of my primary take-aways was that going
in and gratuitously refactoring working code (which we would be doing if we enforced any policy
by, say, removing the pattern) is almost always wrong. If it works, don't "fix" it. If you
have to go into the code *anyway*, then feel free.

I guess my approach rather depends on how heavily I'm going into some code. A minor code change
and I'll do my best to respect the style already there. Major surgery and I'm much more willing
to re-do things to match my preferences. Heck, I'm even managing to refrain from reformattiong
the whole file, what more do you want?

That's all I want to say about that.... 
                
> Don't allow IndexWriterConfig setters to chain
> ----------------------------------------------
>
>                 Key: LUCENE-3756
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3756
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>
> Spinoff from LUCENE-3736.
> I don't like that IndexWriterConfig's setters are chainable; it
> results in code in our tests like this:
> {noformat}
> IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT,
new MockAnalyzer(random)).setMaxBufferedDocs(2).setMergePolicy(newLogMergePolicy()));
> {noformat}
> I think in general we should avoid chaining since it encourages hard
> to read code (code is already hard enough to read!).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Mime
View raw message