The Case for Single-Purpose Services: Understanding the Non-Agnostic Context and a Strategy for Implementation
Justifying the extra investment for developing a single-purpose
service – a service expected to solve only one large business problem -
instead of putting the single-purpose logic inside a
non-service-oriented application can be challenging. Reuse, the most
popular motivation for creating services, will not apply. So where's
the business case? Acceptable justifications can include: enabling
support for multiple providers, isolating logic from change,
centralizing IT-support for a given business process, service
composition optimization, and separation of concerns. Although
performance is commonly referenced as a reason to not create services,
that line of thought is not always valid. By Herbjorn Wilhelmsen.![]()
![]()
Introduction
![]()
Services
are useful, but they come with a price tag. The cost of developing a
service is higher than the cost of developing a traditional
(non-service-oriented) application, primarily due to the extra work and
infrastructure required. Another common concern when creating and
consuming services is the possibility of a performance hit. Together
these issues hint that even if you've decided to wholeheartedly adopt
SOA, you may not want or need to move all your functionality into
services. This is where the application Service Encapsulation becomes a focal point as we need specific criteria to determine what should and should not be encapsulated into services.
![]()
To make this determination, we will take a look at three different aspects:
| • | acceptable reasons for creating a service |
| • | costs associated with creating a service |
| • | and, of course, the performance issue |
Reasons to Create a Service
Any service that is created needs to have a cleanly defined responsibility. The capabilities it exposes should clearly fall within this defined responsibility. In the case of a single-purpose service, it can be argued that it may be better to implement single-purpose logic as a non-service-oriented application. Let's take a closer look at some of the more important considerations:
When logic is incorporated into a service, it is potentially available for reuse by multiple applications, some of which may themselves be services. Reuse leads to reduced development and maintenance effort, which translates into a lower cost of ownership and can further result in improved quality and lower risks [REF-2]. Reuse is also an important part of the agile IT enterprise. Composing existing logic to solve larger business problems is more efficient than writing all of the logic from scratch.
Alas, enabling this kind of reuse is not as easy as just incorporating logic into services; it often requires a lot of thinking and design effort to create a service that is truly reusable. But, it can be done. With regards to single-purpose services, reuse is usually not a consideration. These services are specific to parent business process logic and therefore serve just that one purpose. Figure 1 illustrates some common service categories [REF-3] and how they relate to each other and business processes.
|
| Figure 1: A Service Inventory typically consists of services from multiple categories. Process-specific services can not be reused when implementing support for other business processes. The more process-agnostic a service is the higher it's reusability |
As just stated, services that cannot be repurposed to automate another business process, as per Non-Agnostic Context, are not considered reusable. However, an important realization here is that logic that solves only one large business problem may still be used by multiple consumers.
Let's explore this notion with a simple analogy. Due to technological advances, the manner in which people perform their jobs today is very different compared to 20 years ago and in the years to come we will probably witness an increase in the rate of technological progress. One kind of change that we have seen is that companies want to enable employees to perform their jobs using different tools in different settings. When we are at our desk we typically expect rich functionality and applications that make the best of our hardware, such as advanced large screens with high resolution and many colors and advanced keyboards with many functions, to name but a few.
On the other hand, we want to be able to do at least some of the same tasks when we are traveling and in that setting we may only have access to, say, a Smartphone. This type of mobile device is much more difficult to work with than a desktop application, and it requires a very different kind of user interface. Processing power, development environments and support for frameworks, among other things, are more limited for Smartphone applications. In spite of these differences, the two applications (desktop and mobile) can still be designed to automate the same task (see Figure 2). As a result, both applications could call the same single-purpose service (which actually does lead to a form of reuse).
|
| Figure 2: Alice, Bob and Carol work for different departments but are responsible for different activities that make up a business process. Some of the process steps need IT support and some don't. Carol owns a desktop application and a smartphone application. She creates a service to encapsulate the process-related logic that she is responsible for and lets her applications call the service. |
- Login or register to post comments
- 2551 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)










Comments
rgiridharan replied on Mon, 2008/12/29 - 4:38am