[ 
https://issues.apache.org/jira/browse/HBASE-2597?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12870224#action_12870224
 ] 

Todd Lipcon commented on HBASE-2597:
------------------------------------

for core code I am less convinced. But, for example, the HTableDescriptor, 
HColumnDescriptor, etc constructors, they could be improved. Even for 
StoreFile, using a builder would make the code easier to *read*, and would make 
these core changes less disruptive to other people building patches on top. (eg 
just spent 40 minutes or so updating one of my patches after the bloom filter 
change added some constructor parameters)

> Use "Builder" pattern instead of many-argument constructors
> -----------------------------------------------------------
>
>                 Key: HBASE-2597
>                 URL: https://issues.apache.org/jira/browse/HBASE-2597
>             Project: Hadoop HBase
>          Issue Type: Improvement
>          Components: client
>            Reporter: Todd Lipcon
>            Assignee: Todd Lipcon
>             Fix For: 0.21.0
>
>
> We've got a lot of objects that have a ton of different constructors with a 
> huge number of parameters. Whenever we add a new parameter, existing callers 
> break, and it's sometimes difficult to keep track of which booleans/nulls 
> correspond to which parameter.
> I'd like to consider moving to the "Builder" pattern in some of these cases. 
> See 
> http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/MapMaker.html
>  for an example of this pattern in action. Another good example is the 
> builder API generated by protocol buffers (search for "builder" on 
> http://code.google.com/apis/protocolbuffers/docs/javatutorial.html )
> I think this pattern makes code more readable and also allows us to more 
> easily change around the number of arguments in our constructors.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to