Chapter 6. Providing Services

We define a service to be a collection of useful actions that are packaged up by a vendor, the service provider, and supplied for use by software components, the clients. An action can be anything that is of benefit to a client. The dialog or conversation between the service and a client is known as a session which is started at a certain point and then stopped. An established session often involves more than one message in each direction. When a client asks the service for an action to be performed on its behalf this is known as a service request. When the service has finished performing the action it sends a request complete message in response (this might be implemented as a simple function return).

A session is often stateful: either the client or, more commonly, the service has to maintain information about the session history in order to be able to communicate. In stateless sessions, the communication consists of independent requests with responses. An example of a stateful software service is a component that provides read and write access to a database since the service may have to track any changes to the database up until the client calls commit or rollback. An example of a stateless service is a math library which provides actions such as returning a random number or the square root of a number.

A key reason for having services is that they offer software reuse which can be used to build software more quickly, more efficiently and more ...

Get Common Design Patterns for Symbian OS: The Foundations of Smartphone Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.