15
B i COSA W kfl E l Basic COSA Workflow Example in a Temporal State Machine GORDON MORRISON in a Temporal State Machine GORDON MORRISON [email protected] 7/11/2010 www.vsmerlot.com

workflow in temporal state machine v1

Embed Size (px)

DESCRIPTION

A basic description using a temporal state machine to show the fundamentals of work-flow.

Citation preview

B i COSA W kfl E lBasic COSA Workflow Examplein a Temporal State Machine

G O R D O N M O R R I S O N

in a Temporal State Machine

G O R D O N M O R R I S O NG O R D O N . M O R R I S O N @ V S M E R L O T . C O M

7/11/2010www.vsmerlot.com

What is workflow?

Workflow is understanding the rules and steps that g pdefine the process of work being performed

Workflow rules require understanding the temporal relationships of binary states, their true or false behaviors and their respective true or false next state transitionstransitions.

Workflow requires the proper placement of detail in abstractionabstraction.

7/11/2010www.vsmerlot.com

Examples

Processing any eventg y Processing documents, languages, or databases User interactions with systemsy

7/11/2010www.vsmerlot.com

Things common to workflow

All have a temporal basisp All are based on rules that have one or more steps All have rules/steps that consist of states that have / p

true and false behaviors Some states do nothing but transition to another

state In temporal logic rules/steps/states do one thing It’s done well It’s coherent

7/11/2010www.vsmerlot.com

Temporal State Machine

Temporal State Machine While (Engine) { While (Engine) {

If(this->table(iTime).f_State()) This->table(iTime).TrueBehavior()

T T Thi bl (iTi ) TrueTrace = This->table(iTime).trace; iTime = table(iTime).NextTrueTime;

Else This->table(iTime).FalseBehavior(); FalseTrace = This->table(iTime).trace; iTime = table(iTime).NextFalseTime;

} }

Table is defined on the next slide

7/11/2010www.vsmerlot.com

Table is defined on the next slide

www.vsmerlot.com

The temporal state machine refers to this logic table, p g ,the seven columns are: Rule name or step displacement

i i Function testing state True behavior Next true behavior to execute Next true behavior to execute False behavior Next false behavior to execute Trace

7/11/2010www.vsmerlot.com

A Workflow Example

RULE TEST STATE TRUE B NEXT T FALSE B NEXT F TRACE rStateMach f Initial pCreate +1 Ignore rError 1000 rStateMach, f_Initial, pCreate, +1, Ignore, rError, 1000 +1, f_Status, pCreated, rReady, pNotCreated, rError, 1001 rReady, f_Approved, pApproved, rAction, Ignore, +1, 2000 +1, f_Rejected, pRejected, rDone, Ignore, +2, 2001

+2 f Cancelled pCanceled Done Igno e E o 2002 +2 f_Cancelled, pCanceled, rDone, Ignore, rError, 2002 rAction, f_Act1, … 4000

rDone, f_Done, … 9000f rError, f_Error, … 9086

7/11/2010www.vsmerlot.com

State Machine Interfaces

temporalMachine.approve;p pp ; Moves the temporal pointer

temporalMachine.cancelled; Moves the temporal pointer to canceled Tests the status Returns a Boolean result Returns a Boolean result

7/11/2010www.vsmerlot.com

Rules

Rules define the workflow Rules are defined in the state machine workflow

table Each row requires that each column have an entry Every state has a true and false behavior

h d f l b h i Every state has a true and false next behavior

Guards are defined as complete rulesL i fl i t f d t fl Logic-flow is separate from data-flow

7/11/2010www.vsmerlot.com

Rules are Complete

Rules consist of one or more stepsp Each step is a row in the logic table

Rules are only entered at their beginning Rules allow looping within the rule Rules can exit from anywhere within the rule Rules are not nested Rules are located in time with the workflow

Wh i i d When an action is approved Next rule or step is ready for test

7/11/2010www.vsmerlot.com

Nested Temporal State Engines

Another Temporal Engine can be called from a rulep g Another object can be created from a rule Another thread can be created from a rule

7/11/2010www.vsmerlot.com

The Temporal Pointer

Managed by the Temporal Engine:g y p g Can be set to the zero rule on each entry Can be left at the last rule or step used

C b id d h h T l E i i Can be provided as an argument when the Temporal Engine is called or reentered

7/11/2010www.vsmerlot.com

Trace / Audit is Inherent

The Temporal Engine Provides a:p g True trace for every state/step False trace for every state/step

The trace can always be on Or the trace can be dynamically bound

d d ff i Turned on or turned off at runtime

7/11/2010www.vsmerlot.com

Breaking the Time Barrier

7/11/2010www.vsmerlot.com

A Temporal Understanding

Question: What are the five most importing things in i li fcreating quality software?

1) Temporal Logic Reduced complexity Reduced complexity

2) Temporal Logic Improved quality

) T l L i 3) Temporal Logic Greater performance

4) Detail4) The devil lives here don’t get carried away with abstraction

5) Abstraction It’s important but to much has caused many a project to fail

7/11/2010www.vsmerlot.com

It s important but to much has caused many a project to fail