DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

DQMH zero-coupling modules like AF?

Hi Guys,

 

I'm trying to understand the various frameworks upsides and downsides. Anyone mind reading this list and pointing out any gaps in my understanding?

 

The (many) upsides of DQMH are things like asynchronous modules that are dynamically called and cloneable, its scripting tools, unit testing api, documentation, simple enough for junior devs, active development, encouragement to document as you go. 

 

When it comes to downsides, my understanding is that neither the modules nor messages are object oriented, so extendibility is harder. I'm also not sure if/how DQMH achieves zero coupling between modules with regard to its messaging like AF does with interface-based messages. (Maybe someone knows how to do zero-coupling messages in DQMH?)

 

I'm not trying to stir debate, just making sure I have the tool's pros/cons reasonably accurate in my head -- I'm looking forward to my first DQMH project should it ever come my way, just gotta make sure I match the tool to the job so I want to make sure my view of the framework is balanced.

 

Thanks,

 

-wavepacket 

 

 


------------------------------------------------------------------------------------

Please join the conversation to keep LabVIEW relevant for future engineers. Price hikes plus SaaS model has many current engineers seriously concerned...

Read the Conversation Here, LabVIEW-subscription-model-for-2022
0 Kudos
Message 1 of 18
(2,834 Views)

I don't recall all the AF terminology. IIRC zero coupled means you are sending a message to an actor that supports a specific interface so you are only coupled to the interface, not a particular concrete actor.

 

DQMH doesn't have that built in. However it is very easy to add. It is easy to wrap the API of a DQMH module in a class and then create an interface for that. Then have all the callers use that interface. If you set up a template correctly, then you can just create a new module from the template and it'll already have everything setup correctly. 

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 2 of 18
(2,804 Views)

Another thing I'll add is that you don't want to over-engineer zero-coupling just for zero-coupling's sake. I've worked on lots of DQMH projects over the years, and modules will call each others' requests, and register for each others' broadcasts, and many times that's perfectly fine. You'll mainly be concerned about coupling if (1) you're writing a re-use module, or (2) you don't want "child" modules (for lack of a better term) sending requests to each other when it makes more sense to have higher-level modules be in charge of sending requests to children.

Message 3 of 18
(2,799 Views)

When talking about zero-coupling, we actually mean zero static linking, right? 

 

In our HSE Application Template / HSE DQMH Flavour, we do two things related to "zero coupling":

 

1. In certain generic places, we call the requests of other modules dynamically (no static linking).

2. All our modules implement the same broadcast called "System Message", so we can register for it dynamically (again, no static linking) wherever we need it. It's a common, shared communication channel.

 

While this is not as elegant as using LVOOP, it serves our needs quite well.




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )


0 Kudos
Message 4 of 18
(2,788 Views)

@Taggart wrote:

I don't recall all the AF terminology. IIRC zero coupled means you are sending a message to an actor that supports a specific interface so you are only coupled to the interface, not a particular concrete actor.

...


Yeah, precisely.

 


@Taggart wrote:

...

DQMH doesn't have that built in. However it is very easy to add. It is easy to wrap the API of a DQMH module in a class and then create an interface for that. Then have all the callers use that interface. If you set up a template correctly, then you can just create a new module from the template and it'll already have everything setup correctly. 


I think this is starting to hit on my interest, but perhaps my question isn't all that sharp yet. I'm now understanding that DQMH modules can be decoupled by managing them in an "tree" where down the tree you request and up the tree you register for broadcasts.

 

I'm now starting to ask a question that isn't as sharp, which is when does it make more sense to use AF. Is it just when you really need dynamical dispatch? 

 

Maybe two recent examples would be helpful to discuss whether AF is "easier" to use than DQMH:

  • let's say I was writing test-code for N projects which each needed an asynchronous module that announced when "a something" was connected (see connectionwatchdog and watchdogdevice from this post)
  • Test sequence extension from suggestion #1 from this post. Extending such a test sequence would be readily accomplishable in AF. One simply inherits the test sequence actor and then overwrites the methods that need changing. 

 

I'm not trying to stir up a debate about AF vs DQMH. Rather the opposite, I'm beginning to feel that DQMH is a reasonable default for asynchronous coding, and I'm just curious when exactly I need to haul out AF. Right now it feels like I'm almost at the position that it's when I "really really need dynamical dispatch".

 

 


------------------------------------------------------------------------------------

Please join the conversation to keep LabVIEW relevant for future engineers. Price hikes plus SaaS model has many current engineers seriously concerned...

Read the Conversation Here, LabVIEW-subscription-model-for-2022
0 Kudos
Message 5 of 18
(2,768 Views)

@Darren wrote:

Another thing I'll add is that you don't want to over-engineer zero-coupling just for zero-coupling's sake. I've worked on lots of DQMH projects over the years, and modules will call each others' requests, and register for each others' broadcasts, and many times that's perfectly fine. You'll mainly be concerned about coupling if (1) you're writing a re-use module, or (2) you don't want "child" modules (for lack of a better term) sending requests to each other when it makes more sense to have higher-level modules be in charge of sending requests to children.


Yeah, I get that. I'm understanding this post to be that all the abstraction layers required for zero coupling frequently have cost (harder to understand, debug, test etc). Those considerations are valid, and might mean that choosing abstraction for the sake of it without articulating the necessity is a business mistake. 


------------------------------------------------------------------------------------

Please join the conversation to keep LabVIEW relevant for future engineers. Price hikes plus SaaS model has many current engineers seriously concerned...

Read the Conversation Here, LabVIEW-subscription-model-for-2022
0 Kudos
Message 6 of 18
(2,766 Views)

@joerg.hampel wrote:

When talking about zero-coupling, we actually mean zero static linking, right? 

 

In our HSE Application Template / HSE DQMH Flavour, we do two things related to "zero coupling":

 

1. In certain generic places, we call the requests of other modules dynamically (no static linking).

2. All our modules implement the same broadcast called "System Message", so we can register for it dynamically (again, no static linking) wherever we need it. It's a common, shared communication channel.

 

While this is not as elegant as using LVOOP, it serves our needs quite well.


By static linking you mean that one module has the other's VIs within the block diagram right? And therefore appear in the dependencies dropdown as listed within the .lvproj?

 


------------------------------------------------------------------------------------

Please join the conversation to keep LabVIEW relevant for future engineers. Price hikes plus SaaS model has many current engineers seriously concerned...

Read the Conversation Here, LabVIEW-subscription-model-for-2022
0 Kudos
Message 7 of 18
(2,764 Views)

@WavePacket wrote:

 

I'm now starting to ask a question that isn't as sharp, which is when does it make more sense to use AF. Is it just when you really need dynamical dispatch? 

 

 


My very snarky answer is when you want to confuse the heck out of whoever the next person is who happens to look at your code.

You can still do dynamic dispatch with DQMH. The thing is the set of messages is fixed. That is to say, you create a DQMH module with a set of messages and you wrap the messaging API in a class and create an interface for that. Then you can have a ton of child classes that all accept the same set of messages. Your calling program just knows the interface, it doesn't care which actual DQMH module get's called behind the scenes.

 

One thing AF claims to do that it claims DQMH can't (at least not as easily)is the following: If you have a DQMH module with a specific set of messages say its an instrument driver. And you have an instrument that takes the same messages except it adds one feature (so another message). You want to have a module for the original and a module for the updated one. In AF your updated one just inherits from the original and you add one method and a message. that's it.


DQMH it's a little harder.You would have to use the original as a template and create a new updated one from the template and add the message. The difference is in AF, you have no duplication. You find a bug in one of the original functions you have to fix it one time in the AF approach. In the DQMH approach you would have to fix it in 2 places.

 

But that's only if you use a naive approach. You can encapsulate all the driver code in a class and throw it in the modules private data. Then you create the child class for the updated instrument. You still have to create another DQMH module. You still have some duplication, but it is only the messaging code. So yes not quite as elegant as AF, but for all intents and purposes same thing and much easier to debug. 

 

You can choose the more elegant solution if you want, but what are you paying for it?

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 8 of 18
(2,755 Views)

@WavePacket wrote:

@Darren wrote:

Another thing I'll add is that you don't want to over-engineer zero-coupling just for zero-coupling's sake. I've worked on lots of DQMH projects over the years, and modules will call each others' requests, and register for each others' broadcasts, and many times that's perfectly fine. You'll mainly be concerned about coupling if (1) you're writing a re-use module, or (2) you don't want "child" modules (for lack of a better term) sending requests to each other when it makes more sense to have higher-level modules be in charge of sending requests to children.


Yeah, I get that. I'm understanding this post to be that all the abstraction layers required for zero coupling frequently have cost (harder to understand, debug, test etc). Those considerations are valid, and might mean that choosing abstraction for the sake of it without articulating the necessity is a business mistake. 


Here is everything you need to know about dependencies and coupling in DQMH. It's really easy to avoid circular dependencies and i don't find it requires any fancy engineering. 

https://youtu.be/_YcfT-Ec0ws

I don't think circular dependencies are the end of the world, but they are so easy to avoid, why would you have them?

 

Edit: I did not mean to mark this as the answer. I must have accidentally clicked on it. I have no idea how to undo that. if you do, let me know.

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 9 of 18
(2,753 Views)

@Taggart wrote:

@WavePacket wrote:

 

I'm now starting to ask a question that isn't as sharp, which is when does it make more sense to use AF. Is it just when you really need dynamical dispatch? 

 

 


My very snarky answer is when you want to confuse the heck out of whoever the next person is who happens to look at your code.
...


That's not enough of a justification? 😜 I joke, I joke. 

 


@Taggart wrote:

@WavePacket wrote:

 

I'm now starting to ask a question that isn't as sharp, which is when does it make more sense to use AF. Is it just when you really need dynamical dispatch? 

 

 


...

 

But that's only if you use a naive approach. You can encapsulate all the driver code in a class and throw it in the modules private data. Then you create the child class for the updated instrument. You still have to create another DQMH module. You still have some duplication, but it is only the messaging code. So yes not quite as elegant as AF, but for all intents and purposes same thing and much easier to debug. 

...


I'm trying to make sure I understand this suggestion -- the "another" DQMH module for the updated instrument only has code for the new functionality in its message handling loop, however in it's event handling loop it has everything duplicated? 


------------------------------------------------------------------------------------

Please join the conversation to keep LabVIEW relevant for future engineers. Price hikes plus SaaS model has many current engineers seriously concerned...

Read the Conversation Here, LabVIEW-subscription-model-for-2022
0 Kudos
Message 10 of 18
(2,744 Views)