hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ryan rawson (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HBASE-2597) Use "Builder" pattern instead of many-argument constructors
Date Fri, 21 May 2010 23:22:21 GMT

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

ryan rawson commented on HBASE-2597:
------------------------------------

is that important to change for core code?  If someone is modifying constructors of something
like StoreFile, they should Know What They Are Doing, and requiring contributors to use a
refactoring-IDE to help them doesn't seem like an undue requirement.

I would like regionserver code to be easy to understand, but require a lot of thought to change.
 The consequences are severe for problems.

> 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.


Mime
View raw message