Best way to handle status rules - state objects or WF?

Best way to handle status rules - state objects or WF?

Old forum URL: forums.lhotka.net/forums/t/5198.aspx


xxxJasonxxx posted on Tuesday, August 05, 2008

I'm debating how to handle business rules related to the "Status" of a purchase order object (a CSLA-based object).

Some of the business rules will be flow control - which status transitions are allowed and which are not.  Other business rules will focus which properties can be changed or which activities can be performed based on the current status.

I'm trying to decide between two different ways of handling this:
   a.) using child objects that follow the "State Design Pattern".
   b.) using WF (state machine).

Anybody have any thoughts on the advantages/disadvantages of these two approaches?

xxxJasonxxx replied on Tuesday, August 05, 2008

If it helps start the discussion....two concerns I have with WF are possible overhead and also breaking encapsulation (are these valid concerns?).

rsbaker0 replied on Tuesday, August 05, 2008

xxxJasonxxx:

...I'm trying to decide between two different ways of handling this:
   a.) using child objects that follow the "State Design Pattern".
   b.) using WF (state machine).

Having been severely bitten by Microsoft at least once in the past by basing a significant aspect of our application on their "latest and greatest" technology, I'd tend to recommend a layered approach that insulates you to some degree from technology changes.

So, I'd opt for (a).

We have several use cases in our application where the set of available "next states" and what property changes are allowed for the current state are easily constrained by simple CSLA validation rules.

Copyright (c) Marimer LLC