On 9/30/07, Greg Stevens <[EMAIL PROTECTED]> wrote:
>
>
> Hi Everyone,
>
> Was just reading a blog post (http://www.objectiveaction.com/kevin/
> index.cfm/2007/9/30/What-is-Scaffolding-and-how-do-I-use-it--
> Part-1#comments) and it made me remember that I am confused on exactly
> what Service CFCs are. I posted this question to the blog, however
> would really like to receive a lot of feedback and different opinions
> on this. So here it goes...
>
> I have been getting more into CFCs and proper OO methodologies lately,
> 90% of it is all making sense and every day more and more becomes
> clear, however one thing that has been bugging me lately is the
> difference between a Gateway CFC and a Service CFC. In my mind a
> Gateway CFC deals with the database when retrieving more then 1
> record.


This is how most CFers are doing it right now, even though it isn't
necessary. You can also have a DAO that deals with both single rows and sets
of rows, if you wish.


> I mainly deal with Beans which extend a DAO, which just
> simplifies things so that I can take an active record approach of
> going with something like user.saveRecord() and have it perform the
> proper DB calls.


Alarm bells here. Inheritance is a very specific coupling between objects
that indicates an IS-A relationship. A Bean IS NOT a DAO. You should not be
extending DAO in your Beans. You can do the same thing with composition, by
passing a DAO into your Bean and when you call user.saveRecord(), the bean
in turn calls dao.save(this) or something like that.

I should be using ColdSpring and injecting the DAO
> into the bean so that only 1 instance of the DAO exists at any time,
> but I just haven't quite made the time to do that yet. I'm tarting to
> get offtrack, sorry.


Yes, you should. ;-)

My question is - I find I need to have a CFC that co-ordinates actions
> between multiple beans, takes some sort of action, performs business
> logic on 2 different beans that may represent 1 class or perhaps 2
> classes (eg/ maybe 2 staff benas or 1 staff bean and 1 company bean).
> I am wondering - would this be considered a Service CFC? A Manager
> CFC? Something else?


The Service Layer is meant to do two things: first, to provide a layer of
abstraction to your model layer as a whole. And second, to handle duties
that don't belong to a single object. These could be things like
orchestrating operations that require using several business objects to
accomplish, or to handle transactions and other business rules that exist at
a level above that of a single business object. So what you describe is just
what a Service CFC is meant for. Most people use Service and Manager
interchangeably.

Hope that helps.

Brian

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