Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

"Interfaces" using AF

I have been working on a way of having actors implement message interfaces without inheriting from each other.

My motivation was to have a "Reset Error" message that I could send to multiple receivers without them all having to have a common parent.

So I developed what I believe to be truly "Zero Coupled" actor interfaces. That is, there is bi-directional decoupled messaging. It requires two abstract messages. It also requires an exchange between the caller and nested actor to exchange concrete children of these messages to "set up" the communication between concrete actors implementing the interface.

I am attaching example code. Interfaces-2.zip

In the example I have the following parent actors:

Manager

Developer

Vending Machine

I have the following messages in the interface:

Wrapper

Candy Bar

Note: Wrapper and Candy Bar classes are the message interface and do not belong to an actor. They are not in an lvlib with an actor. They are the stand alone interface.

The Wrapper message class contains a Candy Bar message class and AF Enqueuer as the data.

Both Vending Machine and Developer implement a child of the Candy Bar message class.

Both the Developer and the Vending Machine are able to receive a Candy Bar message. The Vending Machine and the Developer are not related to each other. The Vending Machine and the Developer are nested actors of the Manager. They both have a data accessor for writing a "Wrapper" message to their private data. This is written at launch by the caller. The caller gives them a concrete child of "Wrapper" that implements receipt of a contained "Candy Bar" message.

The nested actors report their respective "Candy Bar" classes to thier caller by placing it in the "Wrapper" class and sending it to their caller (the Manager).

From this point forward the Manager can send "Candy Bar" messages to both the Developer and the Vending Machine and they call the Do.vi for those respective messages.

I tried to document the code in the example to make it easy to understand.

I am thinking about alternatives to the data accessor for discovering the message interface for different actors.

I believe this could be a way for LabVIEW users to implement message interfaces without using inheritance of the Actors.

Please take a look and provide feedback. I think this communication pattern could be extremely useful and potentially worth making a full feature of AF.

Casey Lamers


Phoenix, LLC


casey.lamers@phoenixwi.com


CLA, LabVIEW Champion


Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!

Download All
Message 1 of 6
(6,515 Views)

Casey,

could you please also provide a LV2014 version?

Cheers

Oli

0 Kudos
Message 2 of 6
(5,375 Views)

Added. Should be visible soon.

Casey

Casey Lamers


Phoenix, LLC


casey.lamers@phoenixwi.com


CLA, LabVIEW Champion


Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!

0 Kudos
Message 3 of 6
(5,375 Views)

Thanks for sharing this example

I like the idea with the wrapper class. I am still kinda digesting the information and thinking about the implications. Also about how this would apply to my existing ZC implementation.

Oli

0 Kudos
Message 4 of 6
(5,375 Views)

Nice Job Casey.

It is really an interesting way to decouple actors, I am still struggling to fully understand, although I feel like it is much better after seeing your presentation at NI Week 2018.

By the way, do you have the source code of that example used in the presentation?

Thanks in advance.

Regards,

Felipe Pinheiro Silva


Follow my blog for LV content!

0 Kudos
Message 5 of 6
(4,150 Views)

Hey Casey,

I must say every time I think I have things figured out with AF, someone comes along and implements another great principle. I remember having my mind blown back when I first heard of "zero coupling" (or as you correctly named it "one way decoupled") and thought this is IT - this is as good, as abstract, as decoupled as we were ever gonna get. Well obviously I was wrong. Thank you for providing this next step in decoupled actor communication.

I have one request though - I looked at the Interfaces-2 exampleand it's great. It got me started. It keeps things simple. But I also looked at your video at NI's Center Of Excellence  (AF understanding the decoupling of messaging in actor framework) and wondered if there was any way to get my hands on that source code, which was used for the demo? The fully decoupled one. Would be much appreciated.

Siegmund

0 Kudos
Message 6 of 6
(3,739 Views)