# Service autonomy principle

Service autonomy is a design principle that is applied within the service-orientation design paradigm, to provide services with improved independence from their execution environments. This results in greater reliability, since services can operate with less dependence on resources over which there is little or no control.

## Purpose

The service-orientation design paradigm emphasizes service reuse as dictated by the service reusability design principle. Under this paradigm of a heavily reused services, reliability becomes critical to ensure service longevity. In turn, service reliability depends on the service's operational control of service logic and underlying implementation resources to reduce dependence on external resources over which it has little or no control such as shared service logic or a shared database, which may not be available when required by the service.
Traditional component-based software development also faces the same autonomy requirements, the provisioning of autonomy and reliability, in such circumstances, is left to the actual run-time environment e.g. by providing fail-over support or by deploying a solution on dedicated servers. However, within service-orientation, the stakes are even higher as a service-oriented solution can be composed of services that exist outside of the organizational boundary. So in this case, it's the design of the service itself that matters and the service needs to be designed in a way that it exercises maximum control over how it fulfills its functionality. The service autonomy principle attempts to provide guidelines for designing autonomous services so that the resulting services are more predictable and reliable.

## Application

The application of service autonomy involves two types of autonomy that allow an increase the overall autonomy of the service, design time autonomy and run time autonomy.

### Design-time autonomy

Design-time autonomy refers to the independence with which the services could be evolved without impacting their service consumers. This type of autonomy is required as the service's underlying legacy resources might need an overhaul or the service's logic might need refactoring in order to make it more efficient.
The application of the service loose coupling and the service abstraction principles helps in attaining design-time autonomy as their application results in services whose contracts are shielded from their logic and implementation and hence, the services could be redesigned without affecting their service consumers.

### Run-time autonomy

Run-time autonomy refers to the extent of the control that a service has over the way its solution logic is processed by the run-time environment. The more control a service has over its run-time environment, the more predictable is its behavior. Run-time autonomy is achieved by providing dedicated processing resources to the service. For example, if the service logic performs memory intensive tasks then the service could be deployed to a server with reserved or conserved resources. Similarly, by providing locally cached copies of data, where applicable, the service's dependency on a remote shared database can be reduced. As a result, the overall autonomy of the service is increased...
There is a direct relationship between run-time autonomy and the design-time autonomy. Increasing the design-time autonomy automatically increases the ability to evolve service's implementation environment.

### Service types

Although increasing service autonomy to the maximum extent is always desirable, it is not always possible to design each and every service with maximum design-time and run-time autonomy. As a result, the services need to be prioritized so that their autonomy could be addressed according to their value for business. This could be done by having a look at the functional context of the service. Services whose functional contexts are independent of any particular business process, e.g. entity and utility services, are good candidates for increasing their autonomy. This is because they offer functionality that is of interest to different types of consumers. On the other hand, business process specific services, e.g. task and orchestrated task services, are less reusable and are dependent upon the individual autonomy of their composed services.

## Considerations

The provisioning of service autonomy may require additional infrastructure and needs to be applied on a per-need, prioritized basis. On some occasions, services may need to be isolated and deployed in a customized and dedicated environment, with emphasis on designing the correct functional context since making fundamental changes to such a service is likely to be difficult.
The autonomy of services that encapsulate legacy resources may be hard to predict and increase. This may require additional analysis on part of utility services, as the level of autonomy depends upon the functionality provided by the service.