2009年9月1日星期二

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

2009/9/1 Colin J <colin.johnson@johnguest.co.uk>:
>
> Avi
>
> Thanks for the reply.  Does this mean that the service layer should simply
> hand things over to a method on the model, unless it needs to do some work
> on access control for example?  I suppose I am having trouble distinguishing
> between 'business logic' in the domain model and whatever needs to go in the
> service layer.  Is it just that there aren't particularly any rules about
> what goes where but good practice might be ACL in the service layer?
>
> Colin

Technically services are part of the domain, they have a bit of a
special place in the domain though, they provide services that do not
naturally fit into the domain. (this is how I read the DDD book
anyway)

I have things like IO services as well as things that "extend" my core
domain models like JSON services that transform the models output into
JSON.

Services are great for keeping things out of the main domain models.

ACL in a service layer makes sense, much more than the in the
application layer as you can then use it outside the MVC triad.

>
>
> Avi Block wrote:
>>
>> The service layer is helpfulc in shielding your controller from nasty
>> logic
>> involving one or more domain objects. For example, if there is some
>> complicated logic involved in creating a new event (let's say there's a
>> difference between whether an administrator is creating it or an
>> "organization" is creating it, that would go in the service layer. Or
>> perhaps if you need to do some ACL checks while looking retrieving some
>> resources, that would go in the service layer.
>> On Tue, Sep 1, 2009 at 7:48 AM, Colin J
>> <colin.johnson@johnguest.co.uk>wrote:
>>
>
> --
> View this message in context: http://www.nabble.com/Understanding-%27Service-Layer%27-and-%27Domain-Model%27-tp25238912p25243385.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
>

--
----------------------------------------------------------------------
[MuTe]
----------------------------------------------------------------------

没有评论: