Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7C2A29CAD for ; Thu, 9 Feb 2012 16:06:25 +0000 (UTC) Received: (qmail 4542 invoked by uid 500); 9 Feb 2012 16:06:24 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 4096 invoked by uid 500); 9 Feb 2012 16:06:23 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 4058 invoked by uid 99); 9 Feb 2012 16:06:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2012 16:06:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2012 16:06:20 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 713BD1AD60D for ; Thu, 9 Feb 2012 16:05:59 +0000 (UTC) Date: Thu, 9 Feb 2012 16:05:59 +0000 (UTC) From: "Erick Erickson (Commented) (JIRA)" To: dev@lucene.apache.org Message-ID: <1290342752.19696.1328803559465.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <56860045.8927.1328630459631.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (LUCENE-3756) Don't allow IndexWriterConfig setters to chain MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ 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