LabVIEW Development Best Practices Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Object Oriented Design Patterns Technical Manual and Exercises

This session will explore how popular software design patterns (ie: Command Pattern and Factory Pattern) can be applied in LabVIEW to develop complex applications that require scalability, extensibility and maintainability. Specifically, we will cover the use of a factory pattern to dynamically load and run plugins within a framework and the use of the command pattern to extend the functionality of a typical queued message handler / state machine. These concepts will be combined to illustrate an example of a object-oriented hardware abstraction layer in LabVIEW.

Summary

This technical manual demonstrates some of the most important object-oriented design patterns and how they can be used in LabVIEW to improve the scalability and maintainability of an application. A functionally equivalent version of the application that was built using a classic producer consumer queued message handler (PC-QSM) pattern is also provided in order to relate the example to a well-known LabVIEW approach.  This application also demonstrates how proper architecture can enable a highly modular application that enables multiple people to work on separate components without impacting or breaking un-related components.  This modularity is made possible by the fact that several dependencies are dynamically loaded at run-time, including the plugins and the images.  In addition, the menu interface was designed separate of this application and is another independent resource.

7-20-2011 11-42-58 PM.png

Revision History

  • 10/12 - New version of manual and demos released for LabVIEW 2012.  One installer places everything in the 'Create Project' dialog.
  • 7/11 - Updated for NIWeek 2011
  • 3/11 - Updated for Developer Days 2011

Setup Instructions

  1. Requires LabVIEW 2012 or later
  2. Download and install the VI Package Manager (VIPM) from here
  3. Run the configuration file with VIPM
  4. Click 'Create Project' from the Getting Started Window

Related Content

Elijah Kerry
Chief Product Manager, Software Platform
_______________________________________________
Follow my Software Engineering for LabVIEW Blog
Comments
Wire_Warrior
Member
Member
on

Is it possible to get a copy of the "UI Framework (PC-QSM)" project VIs that are referenced in the demo script? 

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
Elijah_K
Active Participant
Active Participant
on

It has been added now

Elijah Kerry
Chief Product Manager, Software Platform
_______________________________________________
Follow my Software Engineering for LabVIEW Blog
franco.atzeni@terna.it
Member
Member
on

Hi Elijah,

Your examples are very interesting.

I'm new with pattern LVOOP develoment technic and just for study I would like to

ask if is it possible have the UML description about UI Plugin Framework

Solution.

Thanks a lot

Franco

Elijah_K
Active Participant
Active Participant
on

Sure thing.  I just added a power point to the document containing four UML slides.  The first two were made in power point and are simple but clear illustrations.  The last two were generated automatically in StarUML directly from the example code.

Let me know what you think.

Eli

Elijah Kerry
Chief Product Manager, Software Platform
_______________________________________________
Follow my Software Engineering for LabVIEW Blog
D60
Active Participant
Active Participant
on

Hi!

Could you post the attached examples in LV09? Thank you!

---
+++ In God we believe, in Trance we Trust +++
[Hungary]
Wulfi
Member
Member
on

It's all for LV11. It would be grate if you can post a verison vor 2010, because thats the newest not beta version...

Elijah_K
Active Participant
Active Participant
on

Versions created in 2010 can be found here (document revision 14)

Elijah Kerry
Chief Product Manager, Software Platform
_______________________________________________
Follow my Software Engineering for LabVIEW Blog
B.Settles
Member
Member
on

I think Wulfi's comment points to a larger problem that I'm sure has been pointed out many times.

NI's marketing strategy of producing a new version of LabVIEW every year while concurrently working three versions in the background may be great for NI, but it sucks for the users that can't upgrade their software every year for a plethora of reasons, code maintenance and money being the big two.

Now I know that even compilers for other languages go through changes and can sometimes be incompatible from one to the next, but I don't think the compilers go through major revisions every year. (feel free to correct me if I'm wrong). So, will NI please look at making a compiler that can span a couple releases or some other solution that helps its user base while still dangling the carrot of must have new features every year.

"All truths are easy to understand once they are discovered; the point is to discover them." -- Galileo Galilei

tstahl
Member
Member
on

There is a post in the ideas exchange for a long-term support version of LabVIEW. It is located at: http://forums.ni.com/t5/ideas/v2/ideapage/blog-id/labviewideas/article-id/4814/page/1

Tim

Elijah_K
Active Participant
Active Participant
on

I understand where you're all coming from on this matter, and I know that there are several threads on this topic.  We are listening, and we have gone to great lengths to improve the transportability of code between versions.  As an example, if you open the 'Save for Previous' dialog in LabVIEW 2011, you'll see that you can save for 2010, 8.6, 8.5, 8.2 and even 8.0.  This has been the case for the last several releases.  Where this breaks down is if you use functionality in a new version that is not available in a previous release, but LabVIEW will do its best to adapt the code for the older version or notify you of any conflicts.

At the risk of sounding like someone in marketing, a large part of the unique value we provide our users is the fact that they can leverage the latest technologies and hardware platforms in LabVIEW.  This is largely made possible by our annual release cadence.  In addition, it allows us to respond to feedback and ideas from users quickly - both 2011 and 2010 feature over a dozen user-submitted features from ni.com/ideas. 

Elijah Kerry
Chief Product Manager, Software Platform
_______________________________________________
Follow my Software Engineering for LabVIEW Blog
B.Settles
Member
Member
on

I understand the benefit of the yearly releases and I appreciate that NI continues to innovate for the user. I also appreciate the save for previsous versions, but my point was really for being able to view examples and code from new versions of LabVIEW in older versions. I understand that some of the code isn't backwards compatible, but that would be limited to newer features that are still being refined and would only be a subset. I just want to be able to look at the code without requesting the person who posted the time to take additional time to post 3 different versions of the same code so everyone could view it. The code wouldn't even have to be executable. Just being able to see the code and then possibly code it my current version of LabVIEW would be enough.

Hmmmm...maybe I'll post an idea on the exchange for a LabVIEW Code Viewer plug-in that would allow you to view code but not run or edit the code (images of the front and block diagrams with embedded links to documentation maybe). The viewer would work for several versions of LabVIEW (maybe 3 or 4 major releases).

Update: Looks like the idea is there, but the proposal was intended for code reviews and allowing people without LabVIEW to see code. http://forums.ni.com/t5/LabVIEW-Idea-Exchange/LabVIEW-Viewer/idc-p/1645222

"All truths are easy to understand once they are discovered; the point is to discover them." -- Galileo Galilei

ANDRES_VANEGAS
Member
Member
on

Best Regards, could post examples in LabVIEW 2009

Jamey
Member
Member
on

I just tried to use the link provided by ElijahK above to get a version of this for 2010 and it brought my straight back to this page where it says at the top "Version 17" not 14.

If you can resolve that it would be great!

doyles
Member
Member
on

If you click on the "search" spyglass next to "VERSION 17" at the top, it will bring you to a revision comparison page.  You can select any version of this page to compare.  The code wasn't added until version 15 and when I downloaded the code it was still 2011.  I was in the session at NI Week that covers this and they stated they are still working on getting a 2010 version.  They "hope to have that out in a couple weeks".

drval
Member
Member
on

I get tired of continually HAVING to ask this question:

Is there a version of this that does NOT require OpenG?

I really think there is an ENORMOUS problem in demo code being offered by NI and the code necessitating OpenG. I highly respect Jim Kring et al but I do NOT have ANY OpenG tools on my system and I do not want them on my system -- only NI code.

At the very least it would be good to mention this on the page pointing to downloads as well as in the presentations and hands on sessions during NI Week 2011.

So long rant shortened: Now what do I do? In other words, how can I remove all the OpenG calls and still preserve functionality?

Elijah_K
Active Participant
Active Participant
on

To remove the OpenG libraries would require that I then re-write identical functionality myself, which defeats the purpose of reuse libraries.  As with all software environments, their is a tremendous value placed on the ability to reuse code and libraries in order to save time and leverage the experience of other people in the community.

The required dependencies are all included in the VI Configuration file, which is attached above (direct link).  If you have VIPM installed, this will ensure that you have all of the correct libraries, which includes OpenG, as well as three others that I borrowed from our systems engineering group.  In all, the level of effort to remove these would be quite high.

I am curious, why are you so opposed to the use of libraries such as the OpenG libraries?

Elijah Kerry
Chief Product Manager, Software Platform
_______________________________________________
Follow my Software Engineering for LabVIEW Blog
drval
Member
Member
on