jdubray
09/14/10

[SOA,BPM,REST] Lifecycle Example

 

I built a simple business entity lifecycle example for someone who had some questions about the concept. I wanted to share it here since this type of concept is still foreign to most people in the industry. The example is about a stock order (buy or sell). At a high level, the lifecycle of the order looks like this:

The order is "prepared" by the customer, who can update it until it is submitted. If the order is a sell order, it needs to be "funded" before it reaches the "submitted" state. From there, the order is waiting to be "executed", the lifecycle allows the order to be "replaced", "revoked", "executed" or "expired". Once the order has been executed it will be settled and then "archived" for a retention period after which it is "deleted".

Business Entity Lifecycle provide a natural "service boundary" where most transitions correspond directly to a service operation. I cannot emphasize enough that orchestration languages (such as BPEL) are a reasonable fit for implementing a lifecycle and if you do so, you exercise one of the key fondamental difference between SO and OO, that is, an implementation element is defined at the service level (not at the operation/method level like in OO) as several operations point to the same implementation element, again unlike OO. When you use a traditional programming model, you spend most of your time, writing and rewriting a BEL engine. There is simply no other way, because this business logic is intrinsic to your information system.

What is interesting too is that each state defines the operations that are enabled (or disabled). They each correspond to a transition from the current state. So you have a very clear view of when exception conditions occur when operations are invoked outside of their desired sequence.

A key concept to understand is that the order lifecycle is independent of the business process that manipulates it. The same oder lifecycle should be valid for a high-frequency trading process, a retail investor process or a private banking process. In a high frequency trading context, some transition might have different guard conditions (for instance the transition from prepared to submitted is likely to be automatic. For private banking customers, the "funded" state might be reached before the funds are actually deposited in the brokerage account, and the "fund" operation might ensure that other securities will be sold to make the funds available before the settlement date. The bottom line is that a business entity lifecycle represents some business logic that is "business process independent". This is probably news to many of you and some of you might say that a BEL is a "long running process" but it is not. It is long running. It is a process in the sense of an operating system point of view (nearly), but it is not and will never be a "business process". The business process is represented by the activities (human or automated) that advance the lifecycle of one or more business entities.

Here is an example of a plausible "retail process", as you can see, it has little to do with the lifecycle itself (in blue the activities of the process, in red the operations invoked on the order service:

 

So today, you have at least 3 models to implement an information system:

a) CRUD / REST

b) MVC

c) Something I call WSPER ("whisper" stands for Web Service, Process, Event, Resource). WSPER is a programming model that supports this combination of business processes and business entity lifecycles

CRUD is the worst possible model, it works ok for business entities that have a CRUDish lifecycle (e.g. Contact). MVC is probably the most tragic mistake of our industry. MVC is a technical pattern. It is good for implementing the GUI part of an activity, but the Model is the model of the view not the "domain model" where Business Entities/Resources can be found. It does not understand anything about users, roles, activities, processes, services .... "Models", "Views" and "Controllers" have no physical counterparts outside the GUI they support. Both CRUD and MVC are responsible for the high level of inefficiency and the low level of reuse that our industry has experienced for decades. The translation of business activities, business processes and business entity lifecycles into CRUD or MVC code is highly inefficient, it leads to tons and tons of boiler plate code being written and rewritten, horrific patterns and frameworks, and ultimately, disillusioned business owners who see how inflexible the resulting solution is. CRUD and MVC code can't be evolved rapidly, and becomes brittle after a few versions.

I am not quite sure why our industry has not "discovered" these concepts yet. If you know the answer let me know. Ah... one more thing, the BPM people don't even understand this, they only care to sell you an executable process layer that dissolves the business entity lifecycles into the process definition. As you can see, that's fantastic for reusing the business entity lifecycle logic across business processes, not to mention when you need to change that business logic, I am sure you'd be jumping at the idea of changing the 15 processes that manipulate that particular business entity.

So why don't you give BEL a try next time? even if ultimately you implement the BEL with some CRUD/RESTful or MVC based programming model? Very quickly you will realize how powerful this concept is and you'll probably want to write your own BEL container or start using something like an orchestration language.

7 comments

# Jason on 09/15/10 at 02:33
I'm sure you are aware that there is a whole body of work around modelling BEL workflows using state-based models such as colored pertri-nets. (e.g., http://wwwis.win.tue.nl/~wvdaalst/). This can also be traced back to the old CASE tools days of StateMate / StateCharts. But for some reason the development side of the industry who now seem to drive BPM only focus on procedural or OO implementations.

The few people I know who use BEL state-machines during design only maintain them implicitly during implementation. E.g., all BPM logic is in a BPEL/BPMN engine and all monitoring is done based on this procedural flow. There is no runtime infrastructure that can be monitored to explicitly find the BEL state. E.g., it is easy to see where a process is in your "retail flow" but not explicitly the state of the stock "order"

Do you believe it is useful to implement _explicitly_ the BEL in a state-machine infrastructure. E.g., maintaining the BEL in a state-machine engine in addition to the BPEL/BPMN engine which implements logic that manipulates the state machine and services?

Or can something like BEDL provide the best of both modelling paradigms?


Jason
# jdubray [Member] Email on 09/15/10 at 05:43
Jason,

thank you for your comment, I am not sure I was aware that Wil was aligned with the concept of BEL. Do you have specific references? Most of the BPM intelligentsia is conveniently ignoring the concept as it would amount to admit 20 years or more of erroneous work. That's not usually what a scientist likes to admit.

There is of course little option to implement BEL and even BPEL engine vendors make it difficult to create the right articulation between BPEL and BPMN. We truly live in a surreal situation. So I am not surprised that people that use lifecycle often have to implement them in an "executable" BPMN environment.

Of course I do believe that it is very important to implement the BEL in its own container. A BEL is highly reusable and can be changed rather independently of the processes that manipulate them, and vice versa. This is key to BELs and information system construction in general. A BEL is self standing and independent of the combination of BELs that are associated within a business process. Tremendous benefits can be derived from such an application model when compared to CRUD or MVC.
# jdubray [Member] Email on 09/15/10 at 05:46
I have provided comments on BEDL here: http://www.ebpml.org/blog2/index.php/2010/04/21/mde-bpm-ibm-s-bedl-analysis

Unfortunately the authors have chosen a very poor articulation to keep the brainless BPM people happy. I am sure there are many people at IBM who are against BELs, admitting that there is indeed a BEL independent of processes would mean that there entire career was a mistake.
# Jason Email on 09/17/10 at 01:11
Thanks.

I didn't mean to imply that Wil is applying his concepts to BPEL. I meant that when designing solutions and mapping to infrastructure, people are left with these choices:
- model BEL states but use a procedural engine (BPEL/BPMN) to implement the process. Get all the non-funct benefits of these engines (recover, failover, transactionality, dehydration, bindings to different protocols/apps, etc). But hard to ensure traceability of the state-based design to the impl. Therefore, harder to ensure integrity as the business model changes over time.
- model BEL states and use a state-machine engine for implementation. Good traceability of design but none of these engines seems to provide the operational functionality of vendor bpel engines. (are you aware of any?)
- Use 2 engines in the infrastructure = increased complexity.
- Hope a hybrid model emerges using BEDL (or similar) and hope the vendors don't bastardize it too much to satisfy their existing bpel engine install base.

Just wondering if you know of anyone who has tried to combine a bpel engine with a state-machine engine in practice.

Its nice that presos like Udi's at infoq (and sites like http://cqrs.wordpress.com/) are getting the idea of the event modelling paradigm to a mainstream audience but the result is a complex implementation because production ready infrastructure doesn't support it.

Jason
# jdubray [Member] Email on 09/17/10 at 06:52
Jason,

yes you are correct, the problem lies exactly here. No vendor has yet delivered a combined engine to manage both the processes and the BELs.

The way I view it (after physically trying to use these engines on real projects -BPEL or executable BPMN) is that you cannot "program graphically". You very quickly his a "wall" drop from the graphical notation into some obscure vendor specific script.

So you are left with
a) build your engines yourself (task engine, process engine and BEL engine).
b) refactor the model of an existing product to make development easier using a textual-DSL (http://www.ebpml.org/blog2/index.php/2010/07/16/mde-more-evidence-that-xtext-is-pure-freedom)
c) use a code generator that generates executable directly from the textual-DSL

I am not quite sure why a vendor jumps on this, they could definitely create a competitive advantage as there is enough evidence now of the validity of the concept.
# Chris Email on 03/12/13 at 15:40
****-
I had posted to Linked in a question "Has anyone got an example service portfolio that can be shared that demonstrates business entities mapped to that service portfolio?" in the Group "SOA Service Oriented Architecture Technology Architects".

I then found this article that I referenced in the posting. And I would like to raise the same question here. My feeling is an example Service Portfolio bridges this concept from theory to practice as it is services and operations that are designed and built.

# jdubray [Member] Email on 03/13/13 at 20:20
Chris,

I assume it would be hard for anyone to publish a service portfolio. All I can say is that I worked with a company recently that was using this concept successfully as a core design pattern for pretty much all their services. These services are of course very concrete and used in production to solve real business problems.

JJ-

Search

 Subscribe







powered by b2evolution free blog software