LabVIEW Idea Exchange

About LabVIEW Idea Exchange

Have a LabVIEW Idea?

  1. Browse by label or search in the LabVIEW Idea Exchange to see if your idea has previously been submitted. If your idea exists be sure to vote for the idea by giving it kudos to indicate your approval!
  2. If your idea has not been submitted click Post New Idea to submit a product idea to the LabVIEW Idea Exchange. Be sure to submit a separate post for each idea.
  3. Watch as the community gives your idea kudos and adds their input.
  4. As NI R&D considers the idea, they will change the idea status.
  5. Give kudos to other ideas that you would like to see in a future version of LabVIEW!
cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
rcpacini

New Enum Class Primitive: "The Defined Enum" (with pictures)

Status: Declined
Already implemented as LV class.

(Resubmitted to include pictures)

 

Similar to the discussions on command and data cluster primitives, it seems many programmers would like the ability to have a primitive to move a message and some additional data easily. The current methods involve casting specific data types to generic types (i.e. Variants) which are then passed to sub-processes. Once in the sub-process, the process reverses and the data is cast back to the specific type. Many times this casting to and from generic data types not only takes time and resources but also requires managing many type def'ed controls for each specific data type used.

 

Here is a traditional method for passing data between processes:

TraditionalConfiguration.png

Alternately, if the message (such as an enum) included the specific data type definition then no casting is required. This idea involves embedding inherancy of private class data into a defined LabVIEW primitive where each command/item is its own class of private data. It's like having your cake and eating it too! Or, it's like having your message and the data too! (cheesy, i know). Below is an idea for the configuration of the "Defined Enum":

DefinedEnumControl.png

Like a tab control, each tab is an Enum Item and the controls within the tab are specific controls associated with the item. The Defined Enum loads a drop-down selection list of the private data associated with the current item.

DefinedEnumBlockDiagram.png

In the block diagram, like property nodes, the accessors would be used to get or set the values of the enum items. 

DefinedEnumAccessors.png

The sales pitch: When developing large applications where there are multiple services running in parallel it is often difficult to develop completely modular processes because the casting to and from specific data types require a control dependancy between the caller and the callee. Eliminating generic data casting would help develop a more robust hierarchy. I applogize if this idea is a repeat. Let me know what you think.

-Ryan

9 Comments
AristosQueue
Proven Zealot

What you ask for is called a LabVIEW class. Yes, really. With all the polymorphism that you're looking for.

 

And your solution to the communication problem of this data? Please check this out: https://decibel.ni.com/content/docs/DOC-17193

AristosQueue
Proven Zealot

I will say that I've been looking for images that make classes easier to view on the diagram, and I may borrow some of your approaches here for that purpose.

MaryH
Community Team
Status changed to: Declined
Already implemented as LV class.
rcpacini
Member

Hi Aristos,

 

Thanks for showing me the Actor Framework using classes, this was exactly what I was hoping for.

 

somebody_that_i_used_to_k
Trusted Enthusiast

Just wanted to add a quick comment to this thread: this idea is an important archive piece for the LabVIEW forums, because it demonstrates a common design challenge with great illustrations. People searching for a solution - yet lacking vocabulary such as "run-time polymorphism" ("dynamic dispatch") and "strictly typing" vs. "stringly typing" - might stumble upon this thread and discover LabVIEW Classes and LVOOP principles! So, +1 to rcpacini for the detailed write-up! 

Wirebird Labs: Expert Toolkits for LabVIEWDeploy, by Wirebird Labs: Expert Toolkits for LabVIEW
drjdpowell
Active Participant

"User Events" are another method in LabVIEW that also allows the equivalient of strictly-types messages, in addition to LVOOP and the "Command Pattern".

Wart
Member

It would be useful to attach a LVOOP implementation of the drawings to complete the loop.  You've then taken a common challenge with great visual documentation and turned it into classes that people are more likely to understand and appreciate.

AristosQueue
Proven Zealot

Wart: Excellent point. I do not have it as images, but I do have that "finish the loop" as video:

http://zone.ni.com/wv/app/doc/p/id/wv-3101

 

This web video shows the progression of how we go from a messaging scheme using an enum and variant pair to a class implementation and then into the Actor Framework for communications.

Oligarlicky
Member

I think this idea has some advantages over OOP:

 

  • Unlimited input and output tunnels
  • It's easier to "sync" all the structures so they all have the same tunnels
  • Direct writing to terminals and locals
  • You can use front panel property nodes without wiring the references through

It also has some disadvantages but I think the advantages make is sufficiently different that the idea should not be "declined"