There are two kinds of services:

1. The Service Layer, which is kind of the public API of the model/business
logic/domain
towards the controller and views. This is what fowler describes as Service
Layer pattern.

2. Domain Services, objects that are not entities or value objects,
but still belong to the domain, for example a BillingService or
something. These services are not necessarily public to the controller or
view,
but may be used by the service layer and domain objects internally.

greetings,
Benjamin

On Wed, 2 Sep 2009 07:38:00 +0100, keith Pope <[email protected]>
wrote:
> 2009/9/1 Colin J <[email protected]>:
>>
>> 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
>>> <[email protected]>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.
>>
>>

Reply via email to