Sunday, July 04, 2004

(.NET Architecture Center Home) Dealing with Concurrency: Designing Interaction Between Services and Their Agents (Building Distributed Applications)

Maarten Mullender
Microsoft Corporation


Create and work with software services and service interactions using design principles that will give you several ways to deal with the challenges of keeping data valid when consumers retrieve and work with the data across a network, while the service carries on with other work.

Introduction
In this article I will discuss some of the challenges created by working with services. I define software services as discrete units of application logic that expose message-based interfaces suitable for being accessed across a network. Consumers (which can be client applications or other services) retrieve data from services and work with that data while the service carries on with other work, thus possibly invalidating that data. I will highlight some of the design principles that you can use to deal with such challenges.

I will not try to provide guidance on building offline applications, nor on preparing the client for offline use by pre-populating the local cache. Rather, I will concentrate on designing service interactions.

The Service Model
Typically, services provide both the business logic and the state management relevant to the problem they are designed to solve. When designing services, the goal is to effectively encapsulate the logic and data associated with real-world processes, while making intelligent choices about what to include and what to implement as separate services.

Services are necessarily very protective of the state that they manage, taking great care to authorize both read and write access, and to validate updates against integrity rules. Services are strongholds for the state they manage and are the definitive authorities on how to manipulate that state. They don't allow direct access to their data, nor will they expose their complete internal state. Instead, they provide copies of the data that they maintain. Services may be said to maintain a "healthy distrust" of outsiders seeking access.

No comments: