Alan,
 
Perhaps your discomfort comes from the fact that the "service" layer is
commonly used for two completely different parts of the layered
architecture.  When using the service to implement use cases, that *is* a
"higher" layer than the domain model.  When using the service to provide
persistence, messaging, configuration etc, that's definitely a lower layer.
It can be convenient to implement both these layers in the service objects
but architecturally they are quite distinct.
 
So, injecting a set of high-level use-case APIs into the business objects?
I'm with you, that's just weird.  Application-specific use-cases have no
place in the domain model, and domain-wide use cases can (should?) be
modelled by the business objects.  But injecting infrastructure and
configuration objects is a very obvious and easy choice.
 
Jaime


  _____  

From: [email protected] [mailto:[email protected]] On Behalf Of
Alan Livie
Sent: Tuesday, 23 December 2008 8:38 PM
To: [email protected]
Subject: [CFCDEV] Re: DAO in Service and/or Business Object


I'm still not 100% comfortable injecting services into business
objects/beans.

Using Martin Fowler's concept of a 'service layer' the service is at a
higher level than the domain model (business objects, DAO's, factories,
strategies etc etc)
In the same way it would feel odd to inject a service into a DAO I also
think its strange injecting services into business objects although I have
worked on a project with things like User.load() etc. Then again I can also
see that if we want our beans to be smart they will have dependencies. I'm
just not sure if services should be the objects wired in to them.

It just feels more natural using something like (from a controller) User =
UserService.getUser(myId) rather than User.load(myid) and I'm also happier
seeing UserService.save(User) than User.save() that calls an injected
service.

I'm happy to be convinced though :-)

Alan



  _____  

From: John Whish <[email protected]>
To: [email protected]
Sent: Tuesday, December 23, 2008 9:43:15 AM
Subject: [CFCDEV] Re: DAO in Service and/or Business Object


I agree with Mark and Jared. The controller should only talk to the
service. The DAO should only talk to the database. The service is a
facade which can talk to the DAO and the User object.






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to