Announcement Announcement Module
No announcement yet.
Should all domain objects have interfaces? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Should all domain objects have interfaces?


    I am currently starting to put together a prototype Struts/Spring/EJB/Hibernate app and am wondering whether the "code to interfaces" best practice applies to domain objects in the same way it does to services and DAOs. I can see the rationale for creating interfaces for all service and DAO classes, I'm just not sure if this holds true for domain objects as well (and, if it does, is it solely to aid testability of non-getter/setter methods on the domain objects?). Any help here would be much appreciated...

    Thanks in advance,

  • #2
    domain objects are generally pojos, sometimes with very fine grained service methods embedded. They are generally not interfaced, domain objects are operated on, you write interfaces for objects that perform operations.