cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Wire = variable..... or wire != variable...

Wire = variable..... or wire != variable...

While reading on the subject of LVOOP, I discovered that LabVIEW does not have the concept of variables.  Below is a quote from that article..

 

"In summary, LabVIEW, as a dataflow language, does not normally have variables. Wires are not variables. Front panel controls are not variables. Even local or global variables are not allocated with a specific lifetime, the way variables are in other languages. Variables are part of a model that conflicts with dataflow. Without variables and a way of defining the lifetime of those variables, construction and destruction are meaningless concepts, and therefore we left them out of the initial language design."

 

 

So why do we tell people that the wires are the variable when there is no such concept in LabVIEW?

 

 

______________________________________________________________________
Message 1 of 31
(5,875 Views)

Re: Wire = variable..... or wire != variable...

I actully say that wires are similar to variables. I specifically do not say they are variables specifically because they do not have a storage scope or concept of existence. The only time the value is "read" is when the wire terminates. You cannot read it at any time. like a physical memory lcation (which a variable is) like other languages. Probably the most similar equivilant would be to say a wire is like a local variable in a traditional language. This value is only stored while in that module and its scope is confined to that module. However, defining scope on a wire is not as easy since the compiler can dispose of it once it has determined nothing else will access it. Scope is not as clearly defined in a dataflow language.

 

However since people coming from traditional languages think in terms of variables it helps to give them some concept of a variable in LabVIEW when teaching them to write code. By at least sying the wire is like a variable you can help to avoid people littering their code with tons of local variables and front panel objects.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 31
(5,862 Views)

Re: Wire = variable..... or wire != variable...

Agreed.

 

I fully understand what you described and agree with it.  The reason I posted this thread is because often I would read replies stating that it was, myself included...  For the reason that you mentionned.  When I read the paragraph in the article, my first reaction was "what??!!", and then as I though about it, it made sense.  Although you can proble it, the wire is more like a reference to a memory location...

 

I can understand why we would say it is (or is like) a variable, because you can change the value along the wire with functions, terminals (control), or property nodes, etc.  With the concept that the value may vary, the closest text-base object would be the variable.

 

I figured I would open the can of worms with this thread and get feedback as to what we should post when people have difficulty grasping the dataflow concept or a graphical language.  If you do not mind, since I like what you posted, I would use a modified version of your explanation.

 

Thanks Mark!

______________________________________________________________________
0 Kudos
Message 3 of 31
(5,844 Views)

Re: Wire = variable..... or wire != variable...

No problem. Feel free to use it. Just remember to pass the kuods along. Smiley Happy



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 31
(5,839 Views)

Re: Wire = variable..... or wire != variable...

some extra ones to get you started Smiley Wink

______________________________________________________________________
Message 5 of 31
(5,836 Views)

Re: Wire = variable..... or wire != variable...

I'll take a sling at it.

 

The wire is data

the wire has a type property (like a variable)

the wire has a buffer associated with it (like a variable)

the value in the buffer can be accessed by a DVR (like an object)

Interesting choice of terminology Data Value Referance not Wire or variable referance but a reference to the value

it has a copy method (like an object)

 

we pass data from function to function and node to node

we copy data from buffer to buffer where a function can modify the buffer contents

 

Essentially without the node the wire is not a variable.  But a wire and a node together define a variable that the function attached to the node needs to operate.  (I bet that's why broken wires allways break the vi.  Data without use and variables without value)

 

 

 

 

 

Message 6 of 31
(5,828 Views)

Re: Wire = variable..... or wire != variable...

A Wire is a quantum string phenomenom! It's a string in space (wire on diagram) with undefined value until you read it! Smiley Very Happy

 

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 31
(5,781 Views)

Re: Wire = variable..... or wire != variable...

You're not Sheldon, are you??

______________________________________________________________________
0 Kudos
Message 8 of 31
(5,761 Views)

Re: Wire = variable..... or wire != variable...

But does the mere act of reading the value of the wire potentially change it's value? Smiley Very Happy


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 9 of 31
(5,751 Views)

Re: Wire = variable..... or wire != variable...


@altenbach wrote:

But does the mere act of reading the value of the wire potentially change it's value? Smiley Very Happy



Actually it does, since i found a bug in 2010 beta whereas a calculation would fail unless i had it wired to an indicator ...

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 31
(5,725 Views)