2009年9月8日星期二

Re: [fw-mvc] Understanding 'Service Layer' and 'Domain Model'

I have been placing services in a "services" folder right next to models, controllers, and forms. The module resource autoloader automatically recognizes this folder as long as your class names start with  "[module]_Service_".

--
Hector


On Tue, Sep 8, 2009 at 3:41 AM, Vincent de Lau <vincent@delau.nl> wrote:
Hi all,

This week, I've been working on a 'service layer' without really realizing it. We have a Domain/DB mapper setup working, but for the more complex tasks I've started to create classes ('handler', 'manager') that effectively are service providers.

One of the questions that I haven't really answered yet is how they fit in the framework and in my application. Basically, I've created classes like My_Model_Request_Handler or just plain My_SearchEngine.

Do you have more pointers and tips on how to organize things?

Thanks,

Vincent de Lau
 vincent@delau.nl

> -----Original Message-----
> From: Paweł Chuchmała [mailto:pawel.chuchmala@gmail.com]
> Sent: Tuesday, September 08, 2009 11:36 AM
> To: Zend Framework MVC
> Subject: Re: [fw-mvc] Understanding 'Service Layer' and 'Domain Model'
>
> On Mon, Sep 7, 2009 at 14:43, Pádraic Brady<padraic.brady@yahoo.com>
> wrote:
> > Hi Colin,
> >
> > The Service Layer is a very thin layer, a place where you find
> methods for
> > easing the interaction with the Model with more aggregate means. For
> > example, tasks which don't fit in just one domain object or mapper,
> or tasks
> > which may use multiple model classes that can be aggregated into a
> single
> > operation. There's no reason to use the Service Layer only - using
> the Model
> > directly is perfectly fine.
>
> Another good use cases for service layer is when you want use the same
> operations
> on Models in controller and web services like SOAP or XMLRPC.
>
> regards,
> Paweł Chuchmała



没有评论: