09-29-2022 02:49 PM
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?
Solved! Go to Solution.
09-29-2022 04:41 PM - edited 09-29-2022 04:42 PM
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.
09-29-2022 07:38 PM
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.
09-29-2022 09:11 PM
@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?
09-29-2022 09:21 PM
@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.
09-30-2022 07:45 AM - edited 09-30-2022 08:41 AM
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.
09-30-2022 08:48 AM
@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.
09-30-2022 09:44 AM
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.
09-30-2022 10:12 AM
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.
09-30-2022 10:14 AM
@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.