[
https://issues.apache.org/jira/browse/LUCENE-3756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13204596#comment-13204596
]
Uwe Schindler commented on LUCENE-3756:
---------------------------------------
bq. This is indicative of a larger worrying trend of people thinking of how to
do something the best way and then trying to prohibit all other ways. It
ultimately makes Lucene less flexible.
I strongly agree! As I said in this, in LUCENE-3736 and other issues. The
builder pattern does not prevent anybody from *not* using it and both patterns
can be used to make code unreadable. But I (and I speak also for other
committers like Shai) want to have the freedom to chain my method calls if we
have builder.
bq. Was LUCENE-3736 really reverted over this coding style? That's definitely
not something we should make a precedent.
Yes, it was reverted because of that. I already committed and closed that
issue, but Mike disagreed (in my opinion, he put not enough stress on his
answer). On IRC I gave the "OK" to revert it (I wanted to be kept out of the
whole process, so I "allowed" him to revert).
bq. Rather than let this be decided by attrition like LUCENE-2308 (freeze vs
builder vs ???), it would seem fairer to perhaps call a straight up vote. This
isn't a deep technical issue, but rather a style issue that most committers
probably have an opinion on.
Yes, please!
My proposal would be (Robert als suggested that to me privately):
- Allow definition of builder patterns, but dont force users to use them
- Don't use the builders to chain in tests (unless it makes it more readable -
it does quite often), at least format the tests like I did in 3736.
> 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: [email protected]
For additional commands, e-mail: [email protected]