Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you organize Interfaces and PPL?


@OneOfTheDans wrote:

Not sure I follow the issue with chained coupling. Do you agree it's standard practice to keep an Actor and its Actor Messages in one library (regardless the naming convention)? Then any Caller Library:Actor is already pulling in the whole Something Useful library, Actor, and dependencies. What additional coupling is added by including Caller Interface.lvclass in the same Something Useful library?


There wouldn't be, in the two actor scenario.  But anyone *else* sending a message from Caller Interface will be linked to the library containing Actor.  (That's where I was trying to go originally, but I was multitasking when I responded...).

 

I am also moving toward having most of my actor's messages in interfaces, with the interface + messages in their own library.  With the interfaces outside of the actor's library, actors aren't coupled.  And interfaces tend to have very little code of their own, so you end up with an actor library coupled with a set of interface libraries, and nothing else.

 


To your other point - do you have a practical example where multiple actors use the same interface? The closest I've come to that has always been naturally solved with inheritance, like a Base Module:Actor (with it's Caller Interface & messages) plus subclasses for My Module.lvclass. The best case I've seen for this was a fellow recently asking about 1 interface for every single message, so Actors could mix/match what they transmit and subscribe. I think this was for GUI work, in particular.


My current project, in fact.  I have hardware sharing its data in a message, and copies of that message go to the UI element and to the logger.  Several of my hardware actors send the same data message, in fact.  (Though, to be fair, there is often value in having messages that are more specific, with respect to both the sender and the receiver.)

 

There are also use cases for wanting parent class behavior shared between actors that take radically different messages.  In a case where I desperately wished for interfaces (but I was working in 2017), I wanted to create remote proxies for other systems, where each proxy had its own messages, but each managed a Network Endpoint in the same way.  I also wanted to swap out my proxies with unit test stubs that took the same messages, but forwarded them to a test harness.  Different core code + different messages = multiple inheritance = base behavior class + interface with messages.

Message 11 of 14
(329 Views)

@cbutcher wrote:

I think (could be wrong) the suggestion is if you split like this:

 

Interface.lvlibp

- Interface

- Public messages for interface methods

 

Concrete.lvlibp

- AwesomeActor

- implementation of the interface

- Private messages as needed

 

then caller only requires the interface, and the app requires both but could conceivably load Concrete at runtime (if you wanted that).

 

An example of coupling more stuff here is if Concrete's AwesomeActor also calls stuff from DatabaseLogging.lvlibp, or FileWriter.lvlibp, etc (because the interface may not care about these things).


This is typically what I do.

0 Kudos
Message 12 of 14
(325 Views)

With my limited, medium-sized AF-based projects, I've come to believe in the following metaphor:

  • LabVIEW Application ~ Stage Play
  • LabVIEW Actor ~ Stage Actor
  • LabVIEW Actor Messages ~ Lines of Dialog

Stage actors can be the same people acting in two different stage plays. However, the lines of dialog they deliver will be contextually dependent on the play's narrative. Only some lines of dialog would have the exact same intent and context across the plays. (Limited reusability.)

 

That said, I still favor using the Actor Framework and LabVIEW Interfaces in the manner you folks have already indicated.

Message 13 of 14
(274 Views)

@cbutcher wrote:

I think (could be wrong) the suggestion is if you split like this:

 

Interface.lvlibp

- Interface

- Public messages for interface methods

 

Concrete.lvlibp

- AwesomeActor

- implementation of the interface

- Private messages as needed

This generally what I do as well, but I often find it useful to break up the Interface library into a two separate libraries: One for Request messages and one for Announcement messages.

CLA CLED AF Guild
0 Kudos
Message 14 of 14
(216 Views)