Builder design pattern with inheritance: is there a better way?

后端 未结 3 1632
失恋的感觉
失恋的感觉 2020-12-24 07:42

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 pop

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-24 08:20

    This is a good implementation strategy for C#.

    Some other languages (can't think of name of research language I've seen this in) have type systems that either support a covariant "self"/"this" directly, or have other clever ways to express this pattern, but with C#'s type system, this is a good (only?) solution.

提交回复
热议问题