> steve_molitor2003 wrote:
>
> > If I understand correctly, a repository lets clients of the domain
> > model find aggregate roots. Clients can only find aggregate roots,
> > and only through repositories. Clients traverse explicit
> > associations from the aggregate root to obtain other objects. An
> > association method may be internally implemented through a DAO or
> > somesuch, but clients don't know that. So repositories are explicit
> > domain objects exposed to clients; DAO's (or whatever) are 'private'
> > implementation details.
> >
> > I really like this distinction, because it allows you to control
> > associations. With public DAO's or finder methods for every entity,
> > explicit associations don't mean much. Clients can call
> > parent.getChildren(), or they can bypass the association method and
> > call ChildDao.findByParentId(parent.getId()) directly. Chaos.
> > Explicitly exposing the query methods clients are allowed to call via
> > repositories, and only allowing 'queries' to aggregate roots is a
> > great idea.
> >
This is a great summary of the benefits of repositories.
I agree with J.B. about "helpers". Some of those other naming schemes amount
to about the same thing. J.B.'s suggestion of query factories seems
reasonable. Something like XxxAssociationQuery seems pretty descriptive, if
you can limit its scope to be used according to aggregate rules.
In any case, you seem to be on the right track.
Eric