M
Mark Wilden
Take a class, RateTableProductCode. It needs to share implementation with
other classes, so the common code is placed in a ProductCode class, from
which it derives. There needs to be an IRateTableProductCode interface so
that objects can be mocked for testing. That interface also has a common
interface which is shared with other interfaces, and that goes in
IProductCode. This all makes sense to me, but I just have a nagging feeling
that such a parallel hierarchy is unnecessary.
interface IProductCode { void foo(); }
class ProductCode : IProductCode { void foo() {} }
interface IRateTableProductCode : IProductCode { void bar(); }
class IRateTableProductCode : ProductCode, IRateTableProductCode { void
bar() {} }
And of course:
interface IRateRecordProductCode : IProductCode { void zam(); }
class IRateRecordProductCode : ProductCode, IRateRecordProductCode { void
zam() {} }
other classes, so the common code is placed in a ProductCode class, from
which it derives. There needs to be an IRateTableProductCode interface so
that objects can be mocked for testing. That interface also has a common
interface which is shared with other interfaces, and that goes in
IProductCode. This all makes sense to me, but I just have a nagging feeling
that such a parallel hierarchy is unnecessary.
interface IProductCode { void foo(); }
class ProductCode : IProductCode { void foo() {} }
interface IRateTableProductCode : IProductCode { void bar(); }
class IRateTableProductCode : ProductCode, IRateTableProductCode { void
bar() {} }
And of course:
interface IRateRecordProductCode : IProductCode { void zam(); }
class IRateRecordProductCode : ProductCode, IRateRecordProductCode { void
zam() {} }