I have a case:
There is SomeNode, which is composed by different basic parts: say some types of A,B,C. There is also a transformation function that will transform an instance of SomeNode to another SomeNode.
However, there can be some other parts added to SomeNode, in addition to A,B,C, so say there might be D as the fourth part of the SomeNode. and So, the transformation function’s interface might also need to change accordingly for the newly added component SomeNode, but there might be some same logic shared.
Then I have been wondering, what’s a good design to abstract SomeNode and its transformation function for easy extensibility? Using trait? how? Some inspiration examples?
Thanks,
For managing modularity, check out Cake pattern (aka Bakery of Doom pattern). There’s been some interesting articles on the topic:
For managing transformations and traits, Scala compiler is the best example I can think of.