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

Dag H. Wanvik commented on DERBY-673:
-------------------------------------

Uploading a partial proof-of-concept patch for this; it is incremental by 
moving from using the node factory to constructors for a subset of the node 
types. When all node types have been converted, the node factory can be 
dismissed. 

I have not created new classes for those node types which share classes, e.g. 
the BinaryRelationalOperatorNode are used by six node types; =, !=, <, <=, >, 
>=. Since many old "init" methods were type overloaded, casting their arguments 
depending on the node type, the patch does create more methods, thus increasing 
foot print some, but not all that much I believe. I'll make some measurements 
later. Code clarity is improved, code reduction is ca 650 lines so far, and 
type safety is improved by stronger typing of constructor arguments .

I have not (yet) made any attempts to uncouple classes from unnecessarily 
inheriting QueryTreeNode (as suggested by Dan).

The regressions run ok with this. 
                
> Get rid of the NodeFactory
> --------------------------
>
>                 Key: DERBY-673
>                 URL: https://issues.apache.org/jira/browse/DERBY-673
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Rick Hillegas
>         Attachments: nodefactory-31.status, nodefactory-31.zip
>
>
> This piece of code once had a purpose in life. It was one of the 
> double-joints which allowed cloudscape to ship with and without compiler 
> support for the synchronization language. Synchronization has been removed. 
> If we want to plug in optional language components, I think there are better 
> ways to do this.
> The NodeFactory turned into a big, sprawling piece of code. At some point 
> this code was slimmed down by telescoping all of its factory methods into a 
> couple unwieldly, weakly-typed overloads backed by cumbersome logic in the 
> actual node constructors. I would like to reintroduce strongly typed node 
> constructors which the parser can call directly. This will make node 
> generation easier to read and less brittle and it will get rid of the now 
> useless NodeFactory class.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to