How to avoid having very large objects with Domain Driven Design

Posted by Pablojim on Stack Overflow See other posts from Stack Overflow or by Pablojim
Published on 2010-05-24T12:10:46Z Indexed on 2010/05/24 12:31 UTC
Read the original article Hit count: 284

We are following Domain Driven Design for the implementation of a large website.

However by putting the behaviour on the domain objects we are ending up with some very large classes.

For example on our WebsiteUser object, we have many many methods - e.g. dealing with passwords, order history, refunds, customer segmentation. All of these methods are directly related to the user. Many of these methods delegate internally to other child object but
this still results in some very large classes.

I'm keen to avoid exposing lots of child objects e.g. user.getOrderHistory().getLatestOrder().

What other strategies can be used to avoid this problems?

© Stack Overflow or respective owner

Related posts about java

Related posts about .NET