Does anyone have a simple, real example (code) of a service 
object and how it interacts with a DAO or Gateway?

----------------------------------------

                                From: Peter Bell <[EMAIL PROTECTED]>
Sent: Monday, April 28, 2008 8:44 AM
To: [email protected]
Subject: [CFCDEV] Re: Noobie Question

+1 - what Brian said :->
On Apr 28, 2008, at 11:38 AM, Brian Kotek wrote:The Service Layer is meant to 
act as an API to your domain model. That means anything external to the model 
should be going through the Service Layer to interact with your model. Your 
controller should never even know that DAO and Gateway objects exist at all.

When you're sending messages to objects internally within the model, you have 
more options as far as whether calls should be going through other Service 
Layer objects or not. Personally, my Service Layer objects will interact with 
things like a Gateway if they are directly managed by the Service object. So if 
I have a UserService, and a UserGateway, then it is acceptable coupling for the 
UserService to make calls to the UserGateway since the gateway is actually a 
property of the service. However, if I also have a LoginService and it needs to 
find out something about a User, I prefer to have the LoginService talk only to 
the UserService. I want to keep it as the single authoritative interface for 
data or behavior related to Users. I would be reluctant to let the LoginService 
make requests directly to the UserGateway as this breaks encapsulation and 
increases coupling, meaning if I need to change how my UserGateway works, I now 
have to change the UserService but also have to figure out if I need to change 
the LoginService as well.

On Mon, Apr 28, 2008 at 7:20 AM, wkolcz <[EMAIL PROTECTED]> wrote:
Thanks. I guess then it might be better to ask when is it most appropriate to 
interact the controller with a Service Object and when to interact with a bean 
to utilize the DOA and Gateway objects? I need to learn what is the strong 
point and weakness of both so I can know when a situation warrants one over the 
other.

Wish there was a real one-stop-resource out there to cover OOD for CF and all 
the design patterns. :-)

----------------------------------------
From: "Brian Kotek" <[EMAIL PROTECTED]>
Sent: Sunday, April 27, 2008 9:07 PM
To: [email protected]
Subject: [CFCDEV] Re: Noobie Question

Wally, you're basically asking the question "what is the best way to build my 
object model?", which is essentially an unanswerable question because the 
answer it "it depends".

When using Reactor and ColdSpring and Model-Glue, how do you know that "this 
way is the better way of doing things"? And what answer do you expect to the 
question "is it right to assume one should use the Service Object to interact 
with the bean, the DAO, and the Gateway?"

The questions that you're asking are so dependent on what your application 
actually needs to do, and the forces at play in your specific environment, that 
they are nearly meaningless without far more context. In some cases the answer 
will be yes and in some, the answer will be no.

On Sun, Apr 27, 2008 at 9:37 PM, Wally Kolcz <[EMAIL PROTECTED]> wrote:

Another thing. Using Illudium PU-36, it creates a Service Object. After reading 
more up on it, is it right to assume one should use the Service Object to 
interact with the bean, the DAO, and the Gateway?




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