02-10-2011 01:53 PM
I was looking into patterns for sending messages. I have been playing with the LapdogAPI and it is pretty cool.
I recently discovered the Asynchronous Message Communication Reference Library. which even has it's own forum.
Does anyone have any comments on AMC? The reason I don't ask on the forum I linked to above is because I would like comments from people who do not use it. I am mostly looking for negatives.
02-10-2011 02:07 PM
Steve, You can PM DaKlu and see if he/she responds.
However, (pause for effect) I tend to be highly impressed with the output from JKI- but, I do not use it. I prefer to "roll-my-own" as opposed to being dependant on fourth-party* tools.
*Party's:
First: CCI
Second: NI
Third: Our specific customer
Fourth: any organization without a finantial investment in the project at hand.
That disclosure stated: I'll restate for clarity-- I tend to be highly impressed with the output from JKI
02-10-2011 04:15 PM
I don't think it is from JKI. I know that the Lapdog messaging library is something that Daklu put together and it is up on Source Forge. The AMC is a reference design published by NI.
02-12-2011 06:03 PM
@SteveChandler wrote:
I would like comments from people who do not use it. I am mostly looking for negatives.
Sorry to disappoint, but I don't have anything negative to say about the AMC. The best feedback you'll get is from people who use the AMC, and if they use it they're not likely to have a lot of negative things to say about it. There are significant differences between the AMC and LapDog's Messaging Library ("LDM" from here on out) but categorizing each feature as positive or negative is subjective and depends a lot on project requirements and personal preference.
Before I comment on the main differences, let me state that I have played with the AMC a few times but I have never used it as part of a real application. On the other hand, I use the LDM all the time. It's a foundational part of everything I write. I can speak to the intent and purpose of the LDM--the AMC... not so much. Maybe Christian, who I believe wrote the AMC, will chime in.
Paradigm
The most obvious difference is the programming paradigm used. LDM is object-oriented; AMC is procedural. If you're trying to decide between which of the two to use, that's as likely as anything to be the determining factor.
In the LDM all messages are instances of, or children of, Message.lvclass. Sending data with a message requires you to create a subclass. In the AMC the message's user data is flattened to a string before being queued up. Object-based messages provide better type-safety. String-based messages are faster to implement. Whatever you do, I highly recommend using a single messaging system in your app. Mixing incompatible systems gets very messy very quickly.
Scope
The AMC is far more ambitious that the LDM. It permits messages to be sent locally or over the network in a way that appears to be mostly transparent to the user. The LDM limits its scope to the types of things queues are normally restricted to. Native queues don't work over the network; neither does the LDM. This is a difference in design philosophy more than anything.
I prefer my reusable foundation classes to be small and highly cohesive. I'll create more complex functionality by combining foundational classes into application-specific mid-level classes (object composition) that are in turn used by the high-level application code. The AMC is roughly equivalent to the mid-level class I would get if I combined a local messaging class with UDP network messaging class.
Dequeue
This is a minor difference, but it is one of my favorite things about the LDM (though it is by no means unique to the LDM.) LDM's Dequeue method traps errors and the Timed Out flag and returns them as predefined messages instead of requiring you to specifically test for them. In my message handling case structure I add cases for "QueueErrorMessage", "QueueErrorInMessage", and "QueueTimeoutMessage". I think it makes my code a lot cleaner and easier to follow.
Subjective Conclusion
LDM was written when I became dissatisfied with string-variant messaging systems. It is a thin wrapper around native queues and intended to be a general purpose messaging system for object-oriented programmers. I suspect (but don't know) the AMC was written specifically for apps that communicate with real time systems. I also suspect (but don't know) that it is very good at doing that.
The tradeoffs? If the AMC meets the needs of your project, it will be very useful. If it doesn't, it's probably nearly useless. For example, what if my network communication needs to use TCP instead of UDP? The source code is in user.lib, so I can't arbitrarily change it for this project. I could make an app-specific copy of the code and customize it, but if I have to do that every time the AMC needs a little tweak it kind of defeats the purpose of a reuse library. Also, if you don't need everything the AMC provides you can end up carrying around a lot of stuff you don't need.
On the other hand, the LDM faces the same obstacles all OO code does. OOP in general creates more layers to drill through before you get to the part that actually does something. Lots of people don't like that and find it more confusing. It also often requires more files on disk than the equivalent procedural code, which is another stumbling block for many. I believe there are some NI technologies that don't support objects yet, like network streams.
At the end of the day you can probably use either one provided you're willing to learn the api.
[Note: I recently posted some LDM details on Lava.]
02-12-2011 06:46 PM
Excellent response!
I am currently in the process of determining which messaging system to use for a plugin type of application. I don't forsee needing to communicate across the network and I am really leaning towards the LDM.
As for the "negative" feedback that I was looking for about AMC. I was just wondering if there could be inherent architectural problems later that I should watch out for. I once ended up with a big mess of an application which was based on the producer consumer with events template in the LabVIEW examples folder. I sort of knew what the issues were but your comments on Lava about the QSM architecture really clarified the nature of the problems. It was one of those "duh" moments for me.
I can not foresee any problems with either of these messaging systems. But I didn't foresee the nightmare that unfolded when using the QSM. I wish I had read that thread on Lava a long time ago.
02-12-2011 08:38 PM
I was just wondering if there could be inherent architectural problems later that I should watch out for.
Nothing jumped out at me. A messaging system is a component of your application, not an attempt to define the flow of execution like the QSM. Even if you choose the "wrong" messaging system you shouldn't see nearly the impact you saw with the QSM.
If you will be passing around a lot of messages you should probably do some performance benchmarks of each system before you make the decision. I've never compared the relative performance of string flattening with object boxing. Oh, and if you do end up using LDM, keep your custom message's accessors static dispatch unless you have to override them in child classes. You do take a slight performance hit with dynamic dispatch.
I wish I had read that thread on Lava a long time ago.
Hmm... I've written a lot on Lava about the QSM. Can you shoot me a message with the link? (I'm preparing a presentation for our local user group mtg next month and I'd like to know what you found useful.)
02-13-2011 10:24 AM
It all started with this thread.
03-07-2011 04:28 PM
Yes, I have. Please read below letter I send to NI,.
Dear NI Managers & Developers,
I just recently found that all basic ideas (but not implementation of
course) behind the NI Asynchronous Message Communication (AMC) which you
published on your website I developed and presented on NIWeeks conferences in
2003 and 2005, and also published in LTR, volume 11 number 1, 2003.
Below I provide these references to my publications:
1) Messaging Architecture Integration", LTR, v.11, Numb.1, 2003
2)"Modules Synchronization in Message-Based Architecture of LabVIEW
Applications", NIWeek 2003 Conference, Austin August 13-15.
3) "The Use of Control Scripts in Message-Based Architecture of LabVIEW
Applications", NIWeek 2005 Conference, Austin August 16-18.
Scientific and Engineering publications are not “free” to copy and paste into your report, article, or website. In scientific community this kind of behavior will be eventually punished very heavily by loosing respect, which practically unrecovered. In programming area, especially in LabVIEW ( I am using this tool for more than 15 years) it is almost common practice, unfortunately.
Best Regards,
Youri Djachiachvili
TEAM Technologies, Inc.
Instrumentation & Control Department
Department Manager/Systems Analyst
03-08-2011 03:51 AM
First, it would be ridiculous to attribute every single architecture or algorithm back to a specific source. If you had to do that, you couldn't move forward, because almost every algorithm or architecture has been done before.
Second, even if you did present it there, that doesn't mean that this is the source of the idea. It could have been developed independently, or based on something else. And as hard as it may be to believe, it is also possible that someone else came up with it before you did.
03-08-2011 11:03 AM
Dear Zealot,
Thank you for such emotional message. I don’t want to analyze your two paragraphs because they illustrate the absence of even a simple logic and contradict to the history of science and engineering. You can do it yourself later probably.
My major disappoint was a certain trend in LabVIEW community to ignore elementary decency or honesty (I am not sure which word in English gives a correct meaning for this case). Unfortunately, I do not know your background, but in serious science and engineering if somebody published his work then he is obligated to accurately reference to previous recently (within ten years at least) published manuscripts or articles. Open please any scientific or engineering article in journal and you will see it.
You can use any published algorithms and architectures in your programs for you specific needs but if you decide to publish some art of your work which is based or used somebody’s published achievement then please reference to the this publication. Doing that everybody will see what portion of work you did and how great your achievement is comparing to the previous art or vice versa.
Best Regards,
Youri