Service abstraction is a design principle that is applied within the service-orientation design paradigm so that the information published in a service contract is limited to what is required to effectively utilize the service The service contract should not contain any superfluous information that is not required for its invocation. Also that the information should be limited to the serviced contract (technical contract and the service level agreement) only, no other document or medium should be made available to the service consumers other than the service contract that contains additional service related information.

Purpose

A service contract that contains details about what it encapsulates (e.g., the logic, implementation and the technology used to build the service) may end up being used in a particular manner by providing the service consumer more knowledge about the working of the service. In the case of service-orientation, more knowledge is not necessarily better. There is a chance that additional information could impede the reusability of the service as the service consumer designer may streamline his design based on this knowledge. However, doing so would affect the evolution of the service contract as now the service consumer is indirectly coupled to the service implementation, which may need to be replaced in the future. This increases the consumer-to-contract type of coupling, which is a positive type of coupling. However, having too much dependence can negatively impact the evolution of both the service provider and the service consumer.

Service abstraction

Information hiding remains one of the key principles within object-oriented paradigm that promotes abstracting away the inner workings of a software program. A classic example would be the use of abstract classes to hide the actual method logic. The same concept is applied by the service abstraction principle in order to hide the unnecessary details about the working of the service with a view to ease the evolution of the service.

Service abstraction

Application

The application of this design principle requires looking into four different types of abstractions that could be applied to a service.

Service abstraction

Functional abstraction

This form of abstraction is dependent upon how much of the service logic is exposed as service capabilities. An example would be of a class whereby some of its methods are private while others are public. A class would only expose those methods as public that it deems to be important to its objects, any helper methods that are not relevant to the objects are kept hidden.

A service contract which has not been subjected to this principle could be termed as a 'detailed contract' that reveals much of business rules and the validation logic. Once this principle has been applied to a fair degree, the contract could be termed as a ‘concise contract’. Further application of this design principle would result in a 'optimized contract' that maximizes the reuse potential of the service.

Technology information abstraction

Any information about the underlying technology used within the service would result in a low technology information abstraction as the service contract explicitly tells the service consumers how the service logic and its implementation are designed. This extra information might result in service consumers being designed in a way that specifically targets that particular implementation, thereby developing consumer-to-implementation coupling.

Logic abstraction

The programmatic details about the service logic need to be abstracted as knowledge about how the service actually performs its functionality can result in service consumers that factor in this information and are consequently designed under these assumptions. This can seriously hamper service logic refactoring efforts and can be considered as an anti-pattern towards the application of the service refactoring design pattern.

Quality abstraction

Quality abstraction relates to the details provided within the service’s accompanying service level agreement. It is important to concentrate only on that kind of information that would actually help in determining the reliability and availability of the service, no other information should be included that exposes unnecessary details e.g. details about how does a service sit within the overall business process and which other services it uses for fulfilling its functionality.