08-05-2021 07:04 AM
@johntrich1971 wrote:
I agree that learning the QMH is worthwhile. I have found my own variations of it to be adequate for most applications. You will find people who swear that lots of different design patterns are best (DQMH, JKI State Machine, Actor Framework, just as a few examples). All of these are good design patterns, but the tool does really need to fit the task. You don't generally need a sledge hammer to drive a nail.
Just a note to any new LabVIEW programmers reading, but I personally would very strongly advise against ever using the NI "QMH"/"Producer Consumer"/"Continuous Measurement and Logging" templates. I would advise against even looking at them. The "JKI State Machine" is a much better design to be introduced to.
I would even (more weakly) warn against the DQMH, due to its use of the NI QMH design internally. Though with the DQMH one can divide a complex application into multiple simpler DQMH modules, which limits the possible problems.
08-05-2021 07:50 AM
@RTSLVU wrote:
Unlike Queues, Channel Wires follow the standard Data Flow paradigm (Input on the left and output on the right).
Channel wires also break the standard data flow paradigm. Their whole purpose is to transmit data from one loop to another while both loops are still running. You may have a visual connection, but a well written messaging application will have visual cues that could be followed as easily as wires which are running backward on the screen. That's just my take on it.
@RTSLVU wrote:
Also With Channel Wires I don't have to pass the Queue around with shift (NOT bleep) registers and pass it through every single state of my state machine whether I am operating on the Queue or not. If I need to read or write a Channel in that state I do it, if I don't then I can ignore the Channel Wire in that state.
Why would you have to pass the queue around with shift registers? The queue reference doesn't change. I create all of my queues prior to entering the main loops. They do tend to be on a single shift register since they're generally saved in an object with other stuff that may change in the loop, but if the queues were the only thing of interest there is no need for a shift register.
@drjdpowell wrote:
Just a note to any new LabVIEW programmers reading, but I personally would very strongly advise against ever using the NI "QMH"/"Producer Consumer"/"Continuous Measurement and Logging" templates. I would advise against even looking at them. The "JKI State Machine" is a much better design to be introduced to.
I would even (more weakly) warn against the DQMH, due to its use of the NI QMH design internally. Though with the DQMH one can divide a complex application into multiple simpler DQMH modules, which limits the possible problems.
I don't disagree with this. Honestly I'm not even sure what the NI shipping examples look like.
08-05-2021 09:01 AM
Why would you have to pass the queue around with shift registers? The queue reference doesn't change. I create all of my queues prior to entering the main loops. They do tend to be on a single shift register since they're generally saved in an object with other stuff that may change in the loop, but if the queues were the only thing of interest there is no need for a shift register.
Honestly I have asked myself that same question. But anytime I posted some code like this without those Shift Registers people would come out of the woodwork to tell me I MUST put Shift Registers on the Queue in my loops.
08-05-2021 09:12 AM
@RTSLVU wrote:
Why would you have to pass the queue around with shift registers? The queue reference doesn't change. I create all of my queues prior to entering the main loops. They do tend to be on a single shift register since they're generally saved in an object with other stuff that may change in the loop, but if the queues were the only thing of interest there is no need for a shift register.
Honestly I have asked myself that same question. But anytime I posted some code like this without those Shift Registers people would come out of the woodwork to tell me I MUST put Shift Registers on the Queue in my loops.
Not sure who was saying this, but in your simple example there is absolutely no need for the shift register. Try it and you will see that it works just fine.
08-05-2021 09:48 AM
Save your queue references in an action engine/global/whatever and you don't really need queue reference wires anywhere except going from your action engine/global/whatever to the queue functions. (As long as you actually update the action engine/global/whatever after you create it, but before you actually use it.)
I guess shift registers were left over from the shipping examples. I used to keep them in a shift register a long time ago, then I found out it just didn't matter.
08-05-2021 03:54 PM
@drjdpowell wrote:
@joerg.hampel wrote:
Personally, I am confident that DQMH is a very good choice - actually, I'm sure it's the best, but that's just me 😉
Ah, but Messenger Library is the bestest 😉
I would beg to differ. Our publish/subscribe messaging system is the bestest of the bestest.
Many years ago before DQMH and Actor Framework I designed a network based messaging system which has proven to be quite flexible and robust. It has been in heavy use for about 15 years now. It is built around multiple classes. It takes a little bit of effort to fully grasp how everything works but if someone is simply using it the framework it isn't much more complex then using queues. Everything has been packaged up very cleanly. It has gotten some refactoring over the years to improve it. Probably the biggest draw back is a central message broker. However in very large systems you can actually deploy multiple message brokers and keep some of the messaging more localized while still allowing messages to be broadcast much more widely. I am in the process of adding in support for TLS on the underlying messaging channels. One very niece thing about this system is that the system can be used in a multi-language environment. We have had Python modules tap into the system and send/receive messages.
08-05-2021 04:23 PM
Fortune favors the prepared mind
I've used QMH as a quick way to knock out a quick tool. I agree with some previous comments that the "Continuous Measurement and Logging" is not a great example. I've never, ever, turned that into something functional.
In my programming you'll find a mix of different techniques as the situation requires. Learning it is good because options are appreciated when solving problems.
08-05-2021 06:02 PM
Also to consider, and not at all trivial, is that with the plain vanilla QMH, you will greatly increase the chances that some knowledgeable in LabVIEW, especially formally trained, will instantly recognize the pattern and can concentrate on what you coded, not how you coded it.
08-06-2021 03:07 AM
@billko wrote:
Also to consider, and not at all trivial, is that with the plain vanilla QMH, you will greatly increase the chances that some knowledgeable in LabVIEW, especially formally trained, will instantly recognize the pattern and can concentrate on what you coded, not how you coded it.
This is why I really wish NI would introduce new templates to replace the current ones. Standardisation is great, but it should be on a simple but decent design.
08-06-2021 04:25 AM
@Mark_Yedinak wrote:
@drjdpowell wrote:
@joerg.hampel wrote:
Personally, I am confident that DQMH is a very good choice - actually, I'm sure it's the best, but that's just me 😉
Ah, but Messenger Library is the bestest 😉
I would beg to differ. Our publish/subscribe messaging system is the bestest of the bestest.
Many years ago before DQMH and Actor Framework I designed a network based messaging system which has proven to be quite flexible and robust.
Hey, I called "bestest". You can't bestest my bestest!
But seriously, have you made your framework public? With good documentation? To a new user a framework that isn't available, or has insufficient documentation, effectively doesn't exist.