The following is Martin Fowler's definition of the Service layer (http://martinfowler.com/eaaCatalog/serviceLayer.html):
"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."
The use of the word boundary in Martin's definition is interesting, as this literally represents the point of separation or boundary between the concerns of the application's business logic in the Service layer and execution contexts caller. This might be a Visualforce or Lightning Component Controller class or a Batch Apex class, as illustrated in the UML diagrams shown in the previous chapter.
The following illustration shows just some of the types of callers that an Apex Service layer is designed to support. By following...