Builder design pattern with inheritance: is there a better way?
问题 I'm creating a series of builders to clean up the syntax which creates domain classes for my mocks as part of improving our overall unit tests. My builders essentially populate a domain class (such as a Schedule ) with some values determined by invoking the appropriate WithXXX and chaining them together. I've encountered some commonality amongst my builders and I want to abstract that away into a base class to increase code reuse. Unfortunately what I end up with looks like: public abstract