You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Gang Tim Liu (JIRA)" <ji...@apache.org> on 2012/08/17 20:59:38 UTC

[jira] [Commented] (HIVE-3394) Refactor a few classes' constructors with creational patterns

    [ https://issues.apache.org/jira/browse/HIVE-3394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436969#comment-13436969 ] 

Gang Tim Liu commented on HIVE-3394:
------------------------------------

Problem
=======
Several classes have many parameters in constructor and it doesn't scale well.

Solution
========
After reviewing design patterns (factory method/abstract factory/builder/static factory) in GOF and builder pattern in Joshua's Effective in JAVA (Item #2), feel builder pattern in effective in Java is a good fit since it is designed to solve our problem.

Details on each instance
========================
1. MStorageDescriptor.java
   use builder pattern
2. ColumnInfo.java
   # of parameter is not big yet but the number of references to the constructors is huge: 40+. risk is high to change them all.
   solution is use javabean pattern (setter/getter) for new parameters in hive 3072
3. ParseContext.java
   use builder pattern
4. CreateTableDesc.java
   use builder pattern
5. ExprNodeColumnDesc.java
   same as #2
                
> Refactor a few classes' constructors with creational patterns
> -------------------------------------------------------------
>
>                 Key: HIVE-3394
>                 URL: https://issues.apache.org/jira/browse/HIVE-3394
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Gang Tim Liu
>            Assignee: Gang Tim Liu
>            Priority: Minor
>
> It's good to refactor the following classes' constructors with builder/factory pattern. This should be done before HIVE-3072 so that HIVE-3072 can refresh according and extend it to skewed use case:
> 1. MStorageDescriptor.java
> 2. ColumnInfo.java
> 3. ParseContext.java
> 4. CreateTableDesc.java
> 5. ExprNodeColumnDesc.java

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