Hi
Jeff,
As
Cody said, ContactService has a public method for returning a query (or if you
like beans, consider a single object using a flyweight with iteration features
built in - email if that isn't obvious - Ihave a blog post on the way). Behind
the scenes it uses ContactGateway to handle the query.
Regarding save, two schools of thought. With
ActiveRecord, you have a save method in the Contact object which then calls the
ContactDAO directly. Other option is to call ContactService.Save(MyContact),
passing in the contact and allowing service to
save.
I am moving towards Contact business object as interface calling DAO for all single record stuff and ContactService singleton service calling ContactGateway for all aggregate stuff.
Best Wishes,
Peter
Peter
---------------------------------------------------------------Original Message-----I am working on a simple contact manager type application using MG Unity and some other things I wanted to play with. I have built all of my low level data objects (bean, dao, gateway) for a Contact, which has one or more Addresses, which then has a State and a Country.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff D. Chastain
Sent: Wednesday, June 28, 2006 3:03 PM
To: [email protected]
Subject: [CFCDev] Service Layer?
Where I am getting stuck is on the "service" layer. In once case, I am looking to create functionality where an entire contact could be updated at once by passing in a struct (i.e. the form scope). So in my mind this means a ContactService with a method to update the contact and that method then utilizes the different contact, address, state, and country beans and daos.
Another requirement though is to obtain a list of the 5 most recently updated contacts. Is this something that would go in the same ContactService or where would this go? I have never had a good grasp on what should go where in terms of a service layer, so I am looking for any input on how service layers are really built and organized.
Thanks
-- Jeff
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).
An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
