wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
wood burning stoves
 
subject: testing domain-model in DDD (subclass vs. interface-impl)
 
Similar Threads
What is dependency injection?
Doubt in method overriding in enum
Circular Redundancy in Java
Object Reference Conversion
Help me to resolve this in Java