Uploaded by Ivan Yakushchenko

17092015 AF AbstractMessaging

advertisement
Actor Framework – Usage of abstract messages
Oliver Wachno, Bürkert Werke GmbH
A concrete approach to explain abstraction….
Abstract Term
Concrete Term
Redness
Red color of an apple
Vehicle
Car, Motorbike
Beer
Weizen, Pils
2
A concrete approach to explain
abstraction….cont’d
Vehicle
3
A concrete approach to explain
abstraction….cont’d
Beer
4
So….
Using abstract terms, we can not describe a specific thing,
but there is a general understanding allowing
interpretation.
Generally, we engineers like to have flesh to the bone and
unprecise descriptions are left to management.
But let’s see, how we can make use of this.
5
Example
„Brake“
Driver
Car
Motorbike
Both vehicles feature a “Brake” method,
but the respective implementation is different.
6
Actor Framework – how messages are
processed
„The Message makes the Actor!“
7
High Coupling Implementation
Car
Motorbike
High Coupling
Is BAD!
It‘s EVIL!
It‘s a fierce enemy to modularity!
Don‘t, don‘t, don‘t do that please!
8
Low Coupling Implementation
Vehicle
Car
Motorbike
9
Low Coupling
•
•
Quite easy to implement
Actors have to inherit from a common predecessor (more
specific than Actor)
Vehicle
Car
Motorbike
•
Each Actor has to implement the corresponding dynamic
dispatch method (or use the parent implementation).
10
Zero Coupling Implementation
Driver
Abstract Message Object
Car
Motorbike
11
Zero Coupling -- how it works
•
•
•
•
Definition of abstract message (sibling of
Message.lvclass)
Per Actor: define a concrete child of the abstract
message
Here comes the tricky bit: the calling Actor („Driver“)
features a message LUT that gets initialized dynamically
by the Subactors („Car“, „Motorcycle“) with their
respective (concrete) message children
When sending a „Brake“ Message, the correct message
object is taken from the LUT and sent to the Subactor.
12
Zero Coupling – really no coupling?
•
•
Using this methodology, there is no data-wise coupling
Subactors are completely exchangeable as long as they
stick to the messaging theme.
E.g. exchange “Car” with “Truck” without having to
change the “Driver” application.
So, no! There is not!
13
Pros & Cons for Abstract Messaging / Zero
Coupling
Actors
are perfectly
exchangeable due to
minimized coupling
Actors are highly cohesive
High modularity
High Scalability
Good Maintainability
 Implementation
efforts
 Advanced programming,
OO & AF knowledge
required
14
Resources
•
https://decibel.ni.com/content/docs/DOC-44559
•
https://decibel.ni.com/content/docs/DOC-37533
15
Download