LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Any downsides to class property nodes?

Solved!
Go to solution

I discovered class property nodes a year ago and they've really grown on me. Compared to data accessor VIs, property nodes are more compact on the block diagram (for >1 property) and much easier to use for inherited properties. Are there any reasons or edge cases where data accessor VIs are still preferred? Or are property nodes simply better in every way?

OneOfTheDans_0-1664480676157.png

Message 1 of 18
(657 Views)

The difference that I see from here is in error handling. 

 

The accessor p node "Could" be set to "Ignore errors" ( which does not ignore them but passes the first error or first warning ) 

 

Additionally, the p node will attempt to be "atomic" running all access without thread switches if possible.  But, might require the UI Thread in some versions of LabVIEW ( /\|/\| check me there the UI Thread should not be absolutely necessary)

 

Regardless,  with debugging disabled so nothing is probing into private data, the error evaluations as shown should generate identical code objects.  Assuming you remove the locals. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 18
(625 Views)
Solution
Accepted by OneOfTheDans

There's some relevant content on class property nodes in my 'Ludicrous Ways to Fix Broken LabVIEW Code' presentation:

 

http://bit.ly/ludicrouslabview

 

If you watch the recording, the class property node stuff starts at 29:15.

Message 3 of 18
(592 Views)

@OneOfTheDans wrote:

I discovered class property nodes a year ago and they've really grown on me. Compared to data accessor VIs, property nodes are more compact on the block diagram (for >1 property) and much easier to use for inherited properties. Are there any reasons or edge cases where data accessor VIs are still preferred? Or are property nodes simply better in every way?

 


 I am also interested in this, do the property nodes have the same behavior for child class objects as the data accessor VIs?

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 4 of 18
(567 Views)

@Jay14159265 wrote:

 I am also interested in this, do the property nodes have the same behavior for child class objects as the data accessor VIs?


Yes, accessor override method VIs behave the same regardless of whether they're regular VIs or property VIs.

Message 5 of 18
(564 Views)

I love property nodes and use them a lot, but still in some rare cases when you modify a property already used in your project, it can happen that property nodes do not update correctly or even cause the editor to crash, which you don't have with plain accessor VIs.

Message 6 of 18
(508 Views)

@JÞB wrote:

might require the UI Thread in some versions of LabVIEW


This is one of my biggest concerns about them. I don't want to sink a large multi-threaded application by locking all accessors to the UI thread. Can anyone confirm whether or not this an issue for class property nodes?


@Darren, @raphschru, great encouragement, thank you! And thanks for acknowledging that these problems are bugs 😄, I've definitely encountered that before and just brute-forced changes until it was fixed.

0 Kudos
Message 7 of 18
(479 Views)
Solution
Accepted by OneOfTheDans

As far as threading is concerned, class property nodes behave identically to accessor subVIs. So the use of a class property node alone won't require the UI thread.

 

I've got some performance-sensitive code that uses tons of class property nodes... they're all marked as inline and things work great.

0 Kudos
Message 8 of 18
(454 Views)

I really like Property nodes. The only downside is that they're harder to find. What do i mean? If you open a vi and do Show all instances, that doesn't work correctly on property nodes. If works if they're in memory and in the same class, but it's not found in a child class. The same is true if you do a Find all callers in the project. 

Still, i think the pros outweigh the cons.

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
Message 9 of 18
(431 Views)

@Yamaeda wrote:

I really like Property nodes. The only downside is that they're harder to find. What do i mean? If you open a vi and do Show all instances, that doesn't work correctly on property nodes. If works if they're in memory and in the same class, but it's not found in a child class. The same is true if you do a Find all callers in the project. 

Still, i think the pros outweigh the cons.


Can you give me specific steps to reproduce this issue? I have not had issues using 'Find' (either in VIs or in the project) for class property VIs, including inherited method VIs.

0 Kudos
Message 10 of 18
(424 Views)