• Cohesiveness of operations
• Completeness of operations
• Data integrity and validity before, during, and after the service
• Reusability of the proposed service.
There’s no hard and fast rule for the number of operations in a service. The service needs to perform the number of operations required to satisfy the service requester—no more and no less.
For a current consumer, it’s easy to create the service based on that consumer’s particular and specific requirements. But, remember, we’re trying to make the service reusable for potential new consumers. Would the proposed service carry too much baggage in terms of functions for a new consumer? If so, what functions might be overkill?
A cohesive set of operations belongs together in one service because they provide a set of related functions. Think of the service from the service consumer’s perspective when assessing cohesion. By considering the consumer’s perspective and addressing the consumer’s key use cases, you make the function of the service your focus.
A service is complete if it provides every needed operation for the targeted consumer’s key use cases. These are a sequence of events, performed through a system that yields an observable result of value for a particular consumer. The “80/20 rule” applies here since 80 percent of the consumer’s usage is handled by 20 percent of the system functions. That 20 percent of the functions are what would be defined as a key use case and it’s an excellent starting point for cohesive, complete service building. Take the other “nice to have” functions and develop additional services. A developer could then take the key use service and compose it with one or more of the nice-to-have services to accomplish some new consumer’s requirements. For a good description of use cases and how to discover them, read Gary Ham’s article, “Four Roads to Use Case Discovery,” circa 1998.
Use the noun-verb naming convention for services and operations to help focus on the functional cohesiveness of the service interface. Simply ask: Is the verb something that the noun does? The service should be expressed as a noun and the operations named using verbs in phrases with clear business meaning. The business intention of the service should be clear, not just the outcome. So, rather than maybe “update customer master record,” you might specify, “enable Internet statements.”
If granularity is too coarse, and you group together large numbers of operations in a single service, then this tends to increase the number of consumers for the service. So, if you perform maintenance or enhancements to that service, you immediately impact many consumers.