What A Software Architect Needs To Know When Using AF PDF
What A Software Architect Needs To Know When Using AF PDF
com
ni.com
Two-Part Session
ni.com
Part I
Fundamentals of Actor-Oriented Design (AOD)
Actor Model Theory
ni.com
ni.com
Actor Theory
ni.com
Actor Theory
An encapsulation of data,
procedures, and threads
Actor
Msg
Actor
Message
Any information passing
between actors
Addr
Address
A label indicating message
destination
ni.com
Actor Theory
Actor Principle #1
A1
A1
A2
A1
A1
!!
A3
A4
Actor Theory
Actor Principle #2
Actors are self-deterministic
Ways to think about it
The actor is responsible for itself
Messages are always requests, never commands
Things are not done to an actor; an actor does things
to itself
If a turkey were an actor, come Thanksgiving we
would ask it to chop off its own head.
Carl Hewitt (paraphrased)
ni.com
Actor Theory
Direct
Hierarchical
A1
A2
Advantages(?):
Easy to implement
Doesnt require much
A4
A3
planning
Feels very efficient
A1
Advantages:
Promotes encapsulation
A3
A2
Easier to reason about
the behavior
Better scalability
A4
A5
A5
ni.com
10
Actor Theory
Summary
ni.com
11
ni.com
12
AOD in LV
Name/Data
Msg
Do.vi
MyMsg
Do.vi
Commonly implemented as
clusters
Msgs are stringly typed
Message and msg handling
code are separate
Requires classes to
implement
Msgs are strongly typed
Message contains msg
handling code
13
AOD in LV
Implementing Addresses
but Dave
An address defines a location. Transports move
messages around. Theyre not the same.
ni.com
14
AOD in LV
Implementing Actors
Actor Brain = Message Handling Loop (MHL)
DQ Msg
= QMH?
ni.com
15
Actor
Focus on sequencing
procedures
Focus on accomplishing
tasks
Thread safe
Scales poorly
Scales well
ni.com
16
Tip #1
ni.com
17
UI Block Diagram
Four Actors
ni.com
18
Tip #2
Exit conditions
Error handling
ni.com
19
DQ Msg
Create
Queue
ni.com
Destroy Queue
20
Tip #3
ni.com
21
ni.com
22
Tip #4
23
ni.com
24
ni.com
25
ni.com
26
Part II
Making the Actor Framework Work for You
1.
2.
3.
4.
5.
6.
7.
ni.com
27
ni.com
28
ni.com
29
Messaging Actors
ni.com
AF:Message.lvclass
30
ni.com
31
ni.com
32
ni.com
33
VI Call Hierarchy
ni.com
34
ni.com
35
ni.com
36
ni.com
MyCallerMHL.vi
ni.com
38
Condition
Indication
Error
~Error &&
ni.com
39
Example:
Add ACK
to Reply
MyActor:Shut Down.vi
ni.com
40
Indication
Error
~Error &&
Indication
~ACK
ACK
ni.com
ni.com
42
ni.com
43
state data
non-state data
ni.com
44
ni.com
45
ni.com
46
MyActor:Find Peaks.vi
ni.com
47
ni.com
48
GOTO 1
AF:Actor:Actor Core.vi
ni.com
49
Handle Error.vi
ni.com
50
ni.com
51
1.
2.
Error 1608 is not cleared: all actors in call chain will stop
ni.com
53
ni.com
54
MyActor:Handle Error.vi
ni.com
55
ni.com
56
1.
2.
3.
ni.com
Debugging Workarounds
1.
2.
3.
ni.com
ni.com
59
ni.com
ni.com
61
Thanks!
Dave Snyder
[email protected]
David Staab
[email protected]
ni.com
62