Domain Model and Service Layer
- From: mikeon@xxxxxxxxx
- Date: 30 Jan 2007 06:09:33 -0800
Hello!
I'm working on a domain model (accorting to DDD) where I represent a
user as an entity.
Creation of a user is handled by a factory i.e.:
UserFactory uf = GetFactory();
User user = uf.CreateUser("name", "login", "email");
What I want to achieve is to be able to send new users an email, when
their account is created.
Where should I put that kind of logic? I understand that sending an
email i.e.: interaction with an external service should be done via
some kind of a service layer object. Where should I use this object?
Possible solutions include the application layer where the create user
call originates from. There I could easily add a call to a service
right after a user is created.
I could put a dependency in the factory class so that it would call
the service.
I could put the dependency in the repository so it calls the service
when object is saved.
What do you think?
--
Michal
.
- Follow-Ups:
- Re: Domain Model and Service Layer
- From: Robert Martin
- Re: Domain Model and Service Layer
- From: H. S. Lahman
- Re: Domain Model and Service Layer
- Prev by Date: Re: Critique of Robert C. Martin's "Agile Principles, Patterns, and Practices"
- Next by Date: Re: Critique of Robert C. Martin's "Agile Principles, Patterns, and Practices"
- Previous by thread: Hot to implement a Scheduler following the requirements...
- Next by thread: Re: Domain Model and Service Layer
- Index(es):
Relevant Pages
|