And 4. "new ConfigTreeNode().init(param1,param2,param3);". Zonglei Dong <[email protected]> 于2019年11月30日周六 下午6:01写道:
> Hi ShardingSphere community, > > > > Now, We are refactoring ShardingSphere’s orchestration module. We have > some problems and want to discuss with community. > > > For Apollo as a ConfigCenter, I want to construct a “ConfigTreeNode” class > for representing the relationships between all config keys and it’s > childrenkeys, and the ConfigTreeNode class define a init() method for > initialize > the relationships. > > > If we want to init the ConfigTree, we can call the init() method like this: > > > ConfigTreeNode root = new ConfigTreeNode(param1, param2, param3); > root.init(param4, param5); > > > Some developer think this isn’t a good practice, want to combine two lines > of code into one line. > > > We discuss some code styles: > > > 1. "ConfigTreeNodeFactory.init(param4, param5)”, but it must define > another ConfigTreeNodeFactory class; > > > 2. "new ConfigTreeNode(param1, param2, param3).init(param4, param5)"; > > > 3. Auto call init() method in ConfigTreeNode’ constructor method, and > caller doesn’t care of it. > > > Which does a good idea and do you have other good suggestions? > > > Thanks! > Zonglei Dong > Apache ShardingSphere > >
