4 、服务层

Service Layer

by Randy Stafford

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.

For a full description see P of EAA page 133

Enterprise applications typically require different kinds of interfaces to the data they store and the 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 interactions may be complex, involv-ing transactions across multiple resources and the coordination of several responses to an action. Encoding the logic of the interactions separately in each interface causes a lot of duplication.

A Service Layer defines an application's boundary [Cockburn PloP] and its set of available operations from the perspective of interfacing client layers. It encapsulates the application's business logic, controlling transactions and coor-dinating responses in the implementation of its operations.

服务层

用一个服务层来定义应用程序的边界。这个服务层建立了一套可用的操作,并且在每个操作操作中调整应用程序的响应!

企业应用通常要求对他存储的数据和他实现的业务逻辑有不同种类的接口。数据加载器,用户界面,集成入口等。尽管他们的目的不同,但是这些接口常常需要相同的交互方式来访问和修改应用程序的数据、调用应用程序的业务逻辑。交互可能非常复杂,包括跨多个资源的事务或者对调整一个动作的多个响应。在每个接口里都分别对这些逻辑编码会造成许多的重复

服务层定义了一个应用程序的边界,从与应用交互的客户角度来看的一套可用的操作。服务层封装了应用的业务逻辑,控制事务和协调它操作实现中响应!

原文地址:https://www.cnblogs.com/xhan/p/1042778.html