2015-08-13 23:54:40 +02:00
|
|
|
---
|
|
|
|
layout: pattern
|
|
|
|
title: Service Layer
|
|
|
|
folder: service-layer
|
2015-08-15 18:03:05 +02:00
|
|
|
permalink: /patterns/service-layer/
|
2015-08-20 21:40:07 +02:00
|
|
|
categories: Architectural
|
|
|
|
tags: Java
|
2015-08-13 23:54:40 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
**Intent:** Service Layer is an abstraction over domain logic. Typically
|
|
|
|
applications require multiple kinds of interfaces to the data they store and
|
|
|
|
logic they implement: data loaders, user interfaces, integration gateways, and
|
|
|
|
others. Despite their different purposes, these interfaces often need common
|
|
|
|
interactions with the application to access and manipulate its data and invoke
|
|
|
|
its business logic. The Service Layer fulfills this role.
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
**Applicability:** Use the Service Layer pattern when
|
|
|
|
|
|
|
|
* you want to encapsulate domain logic under API
|
2015-08-15 18:03:05 +02:00
|
|
|
* you need to implement multiple interfaces with common logic and data
|
2015-09-03 18:17:07 +05:30
|
|
|
|
|
|
|
**Credits:**
|
|
|
|
|
|
|
|
* [Martin Fowler - Service Layer](http://martinfowler.com/eaaCatalog/serviceLayer.html)
|
2015-09-24 12:23:02 +05:30
|
|
|
* [Patterns of Enterprise Application Architecture](http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420)
|