Service layer pattern

From CSSEMediaWiki
Revision as of 03:23, 25 November 2010 by WikiSysop (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The definition for the Service Layer Pattern is “defines an application’s boundary with a layer of services that establishes a set of available operations and coordinates the application’s response in each operation”.

A service layer always defines the application’s boundary and the responsibilities from the client’s view point. The business logic are usually be considered as domain logic and application specific logic. When application logic and domain logic are mixed together, the result domain logic class becomes less reusable and hard to maintain or extend. The Service Layer can be used in this kind of situation to factor the application specific logic our from the domain logic.

There are two ways of implementing the Service Layer Pattern. One is the domain façade approach which builds a façade to invoke the business logic provided by the domain logic classes. Another approach is named the operation script approach, which builds a layer of classes for the application logic with the encapsulated business logic from those business logic classes.

When to Use It

The Service Layer patter should only be used when there are more than one kind of client or the application use case involves multiple transactional resources. In other cases, the benefits of using Service Layer are hugely compromised by the constructing effects.

Personal tools