Hi Matt. You said ... 

'But then whose job
is it to call the rich/business logic functions on that User bean? The
controller? Yet another service? Ahhhhhh! Of course the only real
answer will be, "It depends."

I think it does. A view may call some of the getters when displaying the data 
in forms and displays, the controller may run some methods too and other 
services. The DAO may also call getters in its CRUD methods.

I'm not sure about your idea of a different service object creating beans. As 
it would be a factory that actually does the createObject() the UserService 
just delegates to the injected factory and returns the new object.

I don't have a problem with a UserService creating a user and injecting itself 
into the User but I'm still not convinced higher level components should be 
injected into lower level components. I will have to do some more thinking on 
why I think that. It may be totally acceptable and break no principles and I'm 
half expecting Jared to tell me to 'get over it' :-)

Alan






________________________________
From: Matt Williams <[email protected]>
To: CFCDev <[email protected]>
Sent: Tuesday, December 23, 2008 3:50:37 PM
Subject: [CFCDEV] Re: DAO in Service and/or Business Object


I too have been looking at this scenario. It seems like it has only
been a few months that CF-ers have been talking about their beans
having a service injected and thus being richer.

Although it isn't technically circular, it does feel so to have the
UserService instantiate a transient User bean, which in turn HAS A
UserService. I haven't gotten my head around this idea yet and am
curious if this is what some people are doing. I would rather have
some other service object that has the simple job of creating the User
bean that can then have the UserService in there.

One way that comes to mind would be to have the controller instantiate
the User bean. I've previously shied away from this idea (and from
using some controller built-in capabilities to create a bean based on
my form data automatically) as it feels like I'm blurring the
controller - model separation.

So I go back to the idea of a bean factory service of sorts that
specializes in instantiating the User bean (or any transient for that
matter) and composing any needed services (e.g., UserService) into
that bean, probably via Brian K.'s bean injector. But then whose job
is it to call the rich/business logic functions on that User bean? The
controller? Yet another service? Ahhhhhh! Of course the only real
answer will be, "It depends."

-------------------------------
Matt Williams


      
--~--~---------~--~----~------------~-------~--~----~
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