it wasn’t the if-
DESCRIPTION
TRANSCRIPT
04/10/23 www.vsmerlot.com 1
The Model is the Code
Using COSA Technology
by
Gordon Morrison
Copyright © 2012
All Rights Reserved
04/10/23 www.vsmerlot.com 2
It wasn’t the “go to”
• The ‘if’ has caused more spaghetti code than the ‘go to’ ever could.
04/10/23 www.vsmerlot.com 3
Simple Calculator Example
• Subtract two negative numbers resulting in a negative result.
04/10/23 www.vsmerlot.com 4
A COSA Solution
• Rules– Operand1– Operate– Operand2– Result– Done– Error
04/10/23 www.vsmerlot.com 5
The Application
• Five Functions– Add– Subtract– Multiply– Divide– Percent
• Clear• Clear Entry
04/10/23 www.vsmerlot.com 6
On Subtract Event
• Handled as Negate
04/10/23 www.vsmerlot.com 7
Run Engine
04/10/23 www.vsmerlot.com 8
Engine On
04/10/23 www.vsmerlot.com 9
Check Event State
• Static State– Compared to
• Dynamic State
04/10/23 www.vsmerlot.com 10
True Rule or Behavior
• Dynamically bind to True Member
04/10/23 www.vsmerlot.com 11
Operand1 Rule
• Step– Negate
04/10/23 www.vsmerlot.com 12
Rule’s True Behavior
04/10/23 www.vsmerlot.com 13
Single Point True Trace
04/10/23 www.vsmerlot.com 14
Trace what you want
• Complex or• Simple
04/10/23 www.vsmerlot.com 15
Next Rule
• Base on True
04/10/23 www.vsmerlot.com 16
Engine Off
• Return to OS…
04/10/23 www.vsmerlot.com 17
Exit to OS
04/10/23 www.vsmerlot.com 18
Model
• Model = Code• Code = Model
04/10/23 www.vsmerlot.com 19
Application
04/10/23 www.vsmerlot.com 20
Next On Click Event
04/10/23 www.vsmerlot.com 21
Back to Engine
04/10/23 www.vsmerlot.com 22
04/10/23 www.vsmerlot.com 23
04/10/23 www.vsmerlot.com 24
Same Rule Next Step
• Previous Step Allows– True Any Number– False One Period
04/10/23 www.vsmerlot.com 25
True Behavior
04/10/23 www.vsmerlot.com 26
Turn Engine Off
04/10/23 www.vsmerlot.com 27
Trace
04/10/23 www.vsmerlot.com 28
Next True Step
04/10/23 www.vsmerlot.com 29
Engine Off
04/10/23 www.vsmerlot.com 30
Return to OS
04/10/23 www.vsmerlot.com 31
Rule Operand1 Step Any Number
• Model = Code• Code = Model
04/10/23 www.vsmerlot.com 32
04/10/23 www.vsmerlot.com 33
04/10/23 www.vsmerlot.com 34
04/10/23 www.vsmerlot.com 35
04/10/23 www.vsmerlot.com 36
04/10/23 www.vsmerlot.com 37
04/10/23 www.vsmerlot.com 38
04/10/23 www.vsmerlot.com 39
04/10/23 www.vsmerlot.com 40
04/10/23 www.vsmerlot.com 41
04/10/23 www.vsmerlot.com 42
04/10/23 www.vsmerlot.com 43
04/10/23 www.vsmerlot.com 44
04/10/23 www.vsmerlot.com 45
04/10/23 www.vsmerlot.com 46
04/10/23 www.vsmerlot.com 47
04/10/23 www.vsmerlot.com 48
04/10/23 www.vsmerlot.com 49
04/10/23 www.vsmerlot.com 50
04/10/23 www.vsmerlot.com 51
Number
04/10/23 www.vsmerlot.com 52
04/10/23 www.vsmerlot.com 53
Now Click Subtract
04/10/23 www.vsmerlot.com 54
Subtract
• On Click Event
04/10/23 www.vsmerlot.com 55
Not Any Number
• Next Step
04/10/23 www.vsmerlot.com 56
Not Any Number
• Next Step
04/10/23 www.vsmerlot.com 57
Not Clear Entry
04/10/23 www.vsmerlot.com 58
Not Clear Entry
04/10/23 www.vsmerlot.com 59
Not Clear
04/10/23 www.vsmerlot.com 60
Not Clear
04/10/23 www.vsmerlot.com 61
Rule Operate
• Not Step Addition
04/10/23 www.vsmerlot.com 62
Not Addition Step
• Rule Operate
04/10/23 www.vsmerlot.com 63
Rule Operate
• Step Subtract
04/10/23 www.vsmerlot.com 64
Rule Operate
• Step Subtraction
04/10/23 www.vsmerlot.com 65
Next Rule
• Operand 2
04/10/23 www.vsmerlot.com 66
First Step
• Return to OS
04/10/23 www.vsmerlot.com 67
Subtracting
04/10/23 www.vsmerlot.com 68
04/10/23 www.vsmerlot.com 69
04/10/23 www.vsmerlot.com 70
Rule Operand2
• Step Negate
04/10/23 www.vsmerlot.com 71
04/10/23 www.vsmerlot.com 72
04/10/23 www.vsmerlot.com 73
04/10/23 www.vsmerlot.com 74
A Negative Number
04/10/23 www.vsmerlot.com 75
04/10/23 www.vsmerlot.com 76
04/10/23 www.vsmerlot.com 77
04/10/23 www.vsmerlot.com 78
04/10/23 www.vsmerlot.com 79
04/10/23 www.vsmerlot.com 80
04/10/23 www.vsmerlot.com 81
04/10/23 www.vsmerlot.com 82
04/10/23 www.vsmerlot.com 83
04/10/23 www.vsmerlot.com 84
04/10/23 www.vsmerlot.com 85
04/10/23 www.vsmerlot.com 86
04/10/23 www.vsmerlot.com 87
04/10/23 www.vsmerlot.com 88
04/10/23 www.vsmerlot.com 89
04/10/23 www.vsmerlot.com 90
Then Click Equals
04/10/23 www.vsmerlot.com 91
On Click Equals
04/10/23 www.vsmerlot.com 92
Not Any Number Step
04/10/23 www.vsmerlot.com 93
Exit Rule Operand 2
04/10/23 www.vsmerlot.com 94
04/10/23 www.vsmerlot.com 95
Not Clear Entry
• Etc.
04/10/23 www.vsmerlot.com 96
Result Rule
• Not Percent Step
04/10/23 www.vsmerlot.com 97
Result Rule
• Equals Step
04/10/23 www.vsmerlot.com 98
Result