You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Andrew Kyle Purtell (Jira)" <ji...@apache.org> on 2022/06/11 23:35:00 UTC

[jira] [Closed] (HBASE-2597) Use "Builder" pattern instead of many-argument constructors

     [ https://issues.apache.org/jira/browse/HBASE-2597?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Kyle Purtell closed HBASE-2597.
--------------------------------------

> Use "Builder" pattern instead of many-argument constructors
> -----------------------------------------------------------
>
>                 Key: HBASE-2597
>                 URL: https://issues.apache.org/jira/browse/HBASE-2597
>             Project: HBase
>          Issue Type: Improvement
>          Components: Client
>            Reporter: Todd Lipcon
>            Priority: Major
>
> 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 was sent by Atlassian Jira
(v8.20.7#820007)