2. Agenda
1. Open Software
2. The Challenge
3. Traditional Approaches
4. The Bread Crumb Problem
5. My Solution
6. Implementation
7. Quantification
8. Why Time is Important
9. Questions
www.vsmerlot.com
2
3. 1. Open Software
• This presentation is based on technology in
my patent
– I have made this patented work freely available
– Anyone can use this technology, go for it!
– The patent is U.S. Patent #6,345,387
• Issued Feb 2002
• Download from the patent office
– This technology is described in my book
• Reads easier and better than my patent
• Title: Breaking the Time Barrier
www.vsmerlot.com
3
4. www.vsmerlot.com
2. The Challenge
• Using your traditional spatial If-Then-Else
(ITE) approach
– Produce a five-function calculator
– add, subtract, multiply, divide, and percent
• The specification is at: www.vsmerlot.com
• Count the number of ITE and Case/Default
Statements
– Count every logic decision point
– Don’t use my temporal approach
4
5. The Challenge Test
• Conform to the specification
• Successfully complete the test matrix
• Final Test is:
– Enter ‘-3.14159 - -2.14159=‘
– There are eighteen entries
– How many logic test will your code make?
www.vsmerlot.com
5
6. 3. Traditional Approaches
• Using the traditional state machine
– Expect ninety plus logic tests
• If – then – else
• Switch – case – default
• Case – value
• How well will you do?
www.vsmerlot.com
6
11. 4. The Bread Crumb Problem
• Edsger Dijkstra once asked, "Why has elegance
found so little following?"
• Imagine a CPU without a program counter (PC)
– The hardware would need to save states continually
• Dropping bread crumbs
– After an interrupt determine where it was executing
• Look for the trail of bread crumbs
– Massive amounts of logic as administrative overhead
• Bread crumb support built in
– This is spatial logic
www.vsmerlot.com
11
12. PC -> Pointer
• The program counter is a temporal pointer
– Hardware is temporal (mostly)
• Spatial application software does not have
an equivalent PC
• Traditional state machines were created to
treat the symptom of no software PC
– Solution drop bread crumbs
– We call these ‘state machines’
www.vsmerlot.com
12
13. 5. My Solution
• Create an application pointer (temporal)
– One ‘time pointer’ for every Engine/Table
– The time pointer keeps track of application
logic
– The time pointer is always available for
progressive protocol based application
– The time pointer eliminates most bread
crumb logic
www.vsmerlot.com
13
14. www.vsmerlot.com
Temporal State Machine (TSM)
• Event or non-event driven applications
• States are true or false
– Transitions are next true or next false
• Three fundamental parts
– Engine (time, logic test, trace, and control)
– Logic-Flow / Rule Table (class)
– Data-Flow / Reusable Members
• Logic-flow is orthogonal to data-flow
– No control flow in data manipulation
– No data manipulation in control flow
14
15. www.vsmerlot.com
TSM Structure
• Engine/Table relationship
– iTime is the pointer into array of rule/step
– Table contains 1 or more rules
– Each rule has a single entry point
• Rules are like basic blocks
• Array of rules consist of steps
– Every step is a binary state
• Each step has a test condition
• Each step has a True Behavior
• Each step has a Next Rule/Step (iTime pointer)
• Each step has a False Behavior
• Each step has a Next Rule/Step (iTime pointer)
• Each step has a Trace (tied to the specification)
15
18. www.vsmerlot.com
Engine / Table Relationship
Engine
• Engine is temporal (iTime)
• Preemption control (while)
– Test condition (if – state)
• Dynamic bind True Behavior
– Next True Rule/Step iTime
– True Trace
• Dynamic bind False Behavior
– Next False Rule/Step iTime
– False Trace
– End if – logic
– End while – control loop
Table
• Each row is a temporal
sequence
– Rule/Step (name)
– Test condition (state)
• True Behavior
– Next True Rule/Step
• False Behavior
– Next False Rule/Step
– Trace (unique to app)
18
19. www.vsmerlot.com
6. Implementation
procedure TCOSAFrame.Run(intState integer);
begin
bEngineLocal := TRUE;
iState := intState;
while bEngineLocal AND bEngineGlobal do
begin
if iState = rRule[iTime].iState then
begin
rRule[iTime].pTrueRule;
True_Trace(iTime);
iTime := rRule[iTime].iTrueRule;
end else
begin
rRule[iTime].pFalseRule;
False_Trace(iTime);
iTime := rRule[iTime].iFalseRule;
end;
end;
end;
iTime is temporal
Determined by logic
19
Dynamically Bind-True
Dynamically Bind-False
20. Delphi Structure Setup
// ************** Temporal Rules Definition ******************
pProcedureType = procedure of Object; // Dynamic Bind Definition
TCOSARules = class
public // the logic test can also be defined as a Boolean function
private
iTime : integer;
iState : integer; // logic test // Static State Definition
pTrueRule : pProcedureType; // Dynamic Bind True
iTrueRule : integer;
pFalseRule : pProcedureType; // Dynamic Bind False
iFalseRule : integer;
iTrace : integer;
end;
www.vsmerlot.com
20
25. www.vsmerlot.com
The User Perspective
(tends to be temporal)
• Calculator
– Enter Operand 1 (optional sign)
– Enter Operation ( + - * / )
– Enter Operand 2 (optional sign)
– Select Result Type ( = % ( + - * / ))
• The user perspective is generally temporal
• Let’s look at entering
– ‘-’ ‘3’ ‘.’ ‘1’ ‘4’ ‘1’ ‘5’ ‘9’
– Followed by the Subtract Operation
25
39. www.vsmerlot.com
Understanding the Time Index
ENTER Rule State True Action Next True False Action Next False
‘-’ rOper1 = <iNeg44>? Negate rOper1+1 Ignore rOper1+1
‘3’ +1 = <iDigit>* Any_Number rOper1+1 Ignore rOper1+2
‘.’ +2 = <iDot59>? One_Period rOper1+3 Ignore rOper1+4
‘14159’ +3 = <iDigit>* Any_Number rOper1+3 Ignore rOper1+4
Time +4
39
• I know where I am
• I know where I came from
• I know where I am going
• At iTime + 4 ‘-’ is “not a number” from iTime+3
Time
41. To Spatial Trace
www.vsmerlot.com
41
T Behavior e->sig Value
O O O
19, g-negated1, 2, 0
20, negated1
21, g-negated1, 1, -0
22, g-negated1, 1010, -0
O O O
31, int1
32, g-int1, 1, -3
33, g-int1, 1101, -3
34, g-frac1, 0, -3.
O O O
37, g-frac1, 2, -3.
38, frac1
39, g-frac1, 1, -3.
40, g-frac1, 1010, -3.
O O O
45, g-frac1, 1107, -3.14159
46, g-Oper1, 1107, -3.14159
47, g-frac1, 3, -3.14159
48, g-opEntered, 0, -3.14159
49, g-Oper1, 0, -3.14159
50, g-Oper1, 3, -3.14159
51, g-opEntered, 2, -3.14159
52, opEntered
53, g-opEntered, 1, -3.14159
54, g-opEntered, 1107, -3.14159
42. Temporal-Logic Counts
www.vsmerlot.com
42
• -3.14159 – ten steps to enter nine actions
– 90% efficient
– 10% of cost is overhead
• -3.14159 - - 2.14195 = thirty steps for
eighteen actions
– 60% efficient
– 40% of cost is overhead
43. Spatial-Logic Counts
• -3.14159 – fifty-four steps for nine actions
– 16.67 % efficient
– 83.34% of cost is overhead
• -3.14159 - - 2.14195 = ninety-six steps for
eighteen actions
– 18.75 % efficient
– 81.25% of cost is overhead
www.vsmerlot.com
43
45. www.vsmerlot.com
A Temporal State Diagram
• Simple state view
• True Behavior
– One green arrow
• False Behavior
– One red arrow
• Temporal
– Trace
– Specification
• Compliance
45
49. www.vsmerlot.com
8. Why Time is Important
• Understanding “Time” in software means not having to do
an “if” to test where the program is executing and what
has happened.
– 23 Logic points-Temporal calculator example
– 112 Logic points-Spatial calculator example
– Sampling of spatial logic tests
• 3 tests for IDC_PLUS
• 4 tests IDC_MINUS
• 2 tests IDC_MULT
• 2 tests IDC_DIVIDE
• 9 tests for IDC_0
• 11 tests for IDC_1_9
49
50. Spatial Software
• Must leave a trail of “bread crumb” states
– This is pure overhead
• Must track down where it was
– This is pure overhead
• Difficult to maintain
– Keeping the overhead straight
• Difficult to modify
– Keeping the overhead straight
www.vsmerlot.com
50
51. Temporal Software
• Keeps a temporal pointer
• Reduces complexity
• Eliminates much of the overhead
• Easier to maintain
• Easier to modify
– Add new rule
– Change the logic
www.vsmerlot.com
51
52. Software Quality
• Testing doesn’t improve quality
– Testing fixes quality problems
– Quality is still poor
• Temporal engineering
– Improves quality
– Reduces overhead logic
– Fewer things to go wrong
www.vsmerlot.com
52
53. Where I’ve Used Temporal
• Disk driver analysis (Symbios Logic)
• Data migration (US West / HP)
• Data filtering
• Lexer/Parser – Data analyzer
• Radar control system
• Robotic arm control
• Embedded applications
• Code generator
www.vsmerlot.com
53
54. The End – Definitions
• COSA – Coherent Object System Architecture
– U.S. Patent #6,345,387 abandoned by inventor
– Available to the public in book: Breaking the Time Barrier
– NOT associated with www.rebelscience.org
• BNF – Backus-Naur Format
– Diagramming the logic of syntax
– Basis for temporal engineering
• ITE – If-Then-Else logic
– commonly referred to as ‘spaghetti code’
• CMU – Carnegie Mellon University
• SEI – Software Engineering Institute at CMU
• CPU – Central Processing Unit
• UML – Unified Modeling Language
www.vsmerlot.com
54