Improving examples to get people up and running with LabVIEW

There’s been a recent discussion between a LabVIEW Product Manager and the LabVIEW Champions on example code I’ve been interested in. The Champions had a lot of great points, there are regular meetings and a private discussion forum for communication, and I wanted to expand on a few of the things that come to my mind and see what others think.

Purpose of Examples
I think of two primary goals of an example. The first is get people up and running with a task they’re starting and the second is to teach people about best development practices. Examples as templates should also demonstrate common applications or needs in applications that people can use as a starting point and customize.

The Right Way or the Fast Way
One specific example used by a LabVIEW Champion got me thinking. Let’s say I want to have my application do something after I click on a button. The traditional way to do this in LabVIEW was to use a while loop and detect a value change on a button. This approach is often referred to as “polling” and it can eat up your processors since the while loop is continually executing and reading the value. When the Event Structure was introduced it provided a much better way where we essentially wait for interumpts from the OS so you’re not just spinning processor cycles polling the current value of a control.

Ideally you should use an Event Structure, you application will respond better and the performance of your application and machine should improve over polling. We do though need to keep in mind that some people are just looking to perform a quick and dirty task where using polling is sufficient and faster to write. Many people transition from this to using that code in a larger application and then the polling approach can break down.

In this case I would want any example that uses polling to call out the pro’s and con’s with polling and mention the event structure as the “right” way and ideally provide a link to that example.

Newer Versions of LabVIEW Introduce Better Ways to Do Something
The event structure is a good example of something that wasn’t in LabVIEW at one time. When it was introduced it provided a better way to develop interactive user interfaces. We should really do something with those older examples shouldn’t we? On Developer Zone we do list the version an example is written in but that doesn’t really inform people that there are features in a newer version, one you may be using, that provides a better way to do something.

Improving Examples in LabVIEW
Improving examples shouldn’t just be about creating more example code. I should ideally be about updating existing examples and in some cases deleting or removing them. Examples are installed with LabVIEW and are available on NI Developer Zone as well as other community sites. The LabVIEW R&D feature specification process does have a section titled “Examples Impact”. I’m going to work with Todd, the product manager I mentioned earlier, to revisit what that sections goals should be. In addition to what examples we need to create, things like what examples need to be updated or obsoleted should be considered. There are some challenges to this process as far as how to manage it and track the use of features in examples but those are details, the overall goal should come first and we should find something we can do today and define what we need in the future.

Your Ideas
If you have any other things you’d like to see in examples or LabVIEW to help get you up and running as well as develop your applications please share your ideas by commenting on this post, I’ll be sure to catalog them and share them.

Advertisements

3 comments

  1. In my opinion, examples should be treated with special care by NI. Sometimes people use these examples as the core of an entire application. Examples from NI should indicate the right way to do things. How much “faster” is it to ignore the event structure? How much trouble can you get into when expanding the example to handle more events if you don’t have the event structure?

    New LabVIEW users look at these examples as benchmarks because they come included with the shipping version. They should be built right, use the best features for the job, and should be code that is representative of proper software engineering.

  2. Perhaps what NI should create is a series of videos or interactive shipping tutorials. Then, each example could also include a manifest detailing which concepts are used in the example and provide links to the relevant tutorials. That way, if the user sees a concept they don’t know and which is not related to the example content, they can go through the relevant tutorial.
    In the case of your example. every example which uses the event structure will also declare itself as using the event structure and will therefore point to the relevant tutorial.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s