Domanda

I am trying to understand the definitions in this document. http://www.opengroup.org/soa/source-book/ontologyv2/service.htm

Their definitions of service, service interface and service contract are either unclear or seem different from what I normally encounter.

Service:

“A service is a logical representation of a repeatable activity that has a specified outcome. It is self-contained and is a ‘black box’ to its consumers.”

Lets say I have a WCF project and it has two Operations StoreFront +GetPrice +AddToCart

The definition says "a repeatable activity". So is the service StoreFront? Or do I have two services (GetPrice and AddToCart).

Service Contract: Has an "effect" class. Is the effect "return price" and " added to cart" ?

È stato utile?

Soluzione

From the same article:

“A capability offered by one entity or entities to others using well-defined ‘terms and conditions’ and interfaces.” (Source: OMG SoaML Specification - my italics)

This is in my opinion a preferable defnition than the one talking about "repeatable activities".

The key word in the definition is capability. Capability refers to Business Capability which is a carry-over from the BPM industry, but in an SOA context refers to a business domain with distinct boundaries.

So from this definition we can surmise that services should be exposed or should operate within a business capability/process boundary. This leads us towards the idea (from the principals or tenants of SOA) that services should be autonomous within well defined boundaries.

In your example, you are asking

So is the service StoreFront? Or do I have two services (GetPrice and AddToCart)

The answer to that as always is "it depends". However, generally Pricing (GetPrice) would belong to a different business capability to Ordering (AddToCart). Additionally, the operations differ in some other important ways:

  • GetPrice is a read operation, while AddToCart is a write operation.
  • GetPrice is a synchronous operation, while AddToCart could very well be asynchronous

So from these we should probably assume that they are two different services from a business perspective.

This assumption has some radical repercussions. If they are two services, then according to SOA they should be autonomous. Meaning that we should be looking to minimize coupling between the services in every possible way, so that as much as possible they can be planned, developed, tested, built, deployed, hosted, supported, and managerd as separate concerns.

Another repercussion is that when you physically separate services to this extent, how can you show this stuff together to your users? They may be different capabilities but they still need to work together on the screen.

Additionally, from a back end perspective Ordering needs to know about Pricing data, otherwise how can order fulfillment happen? If you've separated the database into two, how can the Checkout service know how much stuff costs, what discounts to apply, etc?

I have posted about this stuff before, so please feel free to have a read. I would recommend reading the excellent article on Microservices by Lewis and Fowler also.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top