Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
workflow in temporal state machine v1
1. Basic
B i COSA Workflow Example
W kfl E l
in a Temporal State Machine
GORDON MORRISON
GORDON.MORRISON@VSMERLOT.COM
www.vsmerlot.com 7/11/2010
2. What is workflow?
Workflow is understanding the rules and steps that
g p
define 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
transitions.
transitions
Workflow requires the proper placement of detail in
abstraction.
abstraction
www.vsmerlot.com 7/11/2010
3. Examples
Processing any event
g y
Processing documents, languages, or databases
User interactions with systems
y
www.vsmerlot.com 7/11/2010
4. Things common to workflow
All have a temporal basis
p
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
www.vsmerlot.com 7/11/2010
5. Temporal State Machine
Temporal State Machine
While (Engine) {
If(this->table(iTime).f_State())
This->table(iTime).TrueBehavior()
T TrueTrace = Thi
T This->table(iTime).trace;
bl (iTi )
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
www.vsmerlot.com 7/11/2010
6. www.vsmerlot.com
The temporal state machine refers to this logic table,
p g ,
the seven columns are:
Rule name or step displacement
Function testing state
i i
True behavior
Next true behavior to execute
False behavior
Next false behavior to execute
Trace
www.vsmerlot.com 7/11/2010
7. A Workflow Example
RULE TEST STATE TRUE B NEXT T FALSE B NEXT F TRACE
rStateMach,
rStateMach f_Initial,
f Initial pCreate,
pCreate +1
+1, Ignore,
Ignore rError,
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,
f Cancelled pCanceled, Done
pCanceled rDone, Igno e
Ignore, rError,
E o 2002
rAction, f_Act1, … 4000
rDone, f_Done, … 9000
rError, f_Error, …
f 9086
www.vsmerlot.com 7/11/2010
8. 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
www.vsmerlot.com 7/11/2010
9. 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
Every state h a true and f l next b h i
has d false behavior
Guards are defined as complete rules
L i fl
Logic-flow is separate from d t fl
i t f data-flow
www.vsmerlot.com 7/11/2010
10. Rules are Complete
Rules consist of one or more steps p
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
When
Wh an action i approved
i is d
Next rule or step is ready for test
www.vsmerlot.com 7/11/2010
11. Nested Temporal State Engines
Another Temporal Engine can be called from a rule
p g
Another object can be created from a rule
Another thread can be created from a rule
www.vsmerlot.com 7/11/2010
12. 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
Can be provided as an argument when the T
b id d h h Temporal E i i
l Engine is
called or reentered
www.vsmerlot.com 7/11/2010
13. 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
Turned on or turned off at runtime
d d ff i
www.vsmerlot.com 7/11/2010
15. A Temporal Understanding
Question: What are the five most importing things in
creating quality software?
i li f
1) Temporal Logic
Reduced complexity
2) Temporal Logic
Improved quality
3) Temporal L i
)T l Logic
Greater performance
4) Detail
The devil lives here don’t get carried away with abstraction
5) Abstraction
It s
It’s important but to much has caused many a project to fail
www.vsmerlot.com 7/11/2010