This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Testing and the fly likes testing domain-model in DDD (subclass vs. interface-impl) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Testing
Bookmark "testing domain-model in DDD (subclass vs. interface-impl)" Watch "testing domain-model in DDD (subclass vs. interface-impl)" New topic
Author

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

manuel aldana
Ranch Hand

Joined: Dec 29, 2005
Posts: 308
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.


aldana software engineering blog & .more
 
GeeCON Prague 2014
 
subject: testing domain-model in DDD (subclass vs. interface-impl)