• Post Reply Bookmark Topic Watch Topic
  • New Topic

testing domain-model in DDD (subclass vs. interface-impl)  RSS feed

manuel aldana
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in DDD you structure your design and code closely to the problem business area, which i think great. after reading some stuff about DDD something stay a bit unclear to me. respective papers never mentioned introducing interfaces for each domain model-element.

this way you can only inject dependencies by subclassing the production class and not passing an implementation of the interface, which i think "more natural" if i unit test.

example (passing by interface-impl, i usually prefer):

following would be more common from the stuff i read, where interfaces are hardly used, most likely because of the danger of having parallel hierachies everywhere -> each model-type has an interface type:

what kind of injection strategy do you follow when working with domain-models? the interface-impl or the subclass passing one?

thanks for your thoughts.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!