LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I'm looking for ugly code that misuses control references

Hi folks,

 

I'm giving a presentation on UI abstraction at GDevCon NA later this month.

I've been scouring the Internet for an example of some ugly code that misuses control references, but I'm not having any luck.

I've seen a few such applications in my career, but for some reason I can't find one.

 

If someone has an example of this and you're willing to show it to a lot of people, can you please help me out by posting a screenshot?

You can obscure stuff that might reveal the context. I'll even give you a shoutout.

 

Thanks very much - I'm very grateful.

 

Regards,

 

Mr. Jim

0 Kudos
Message 1 of 10
(346 Views)

I abused them when I was younger. I thought they were analogous to pointers in C. I have not seen this code in years, but I bet it has tons of control references. Just let people know I have changed for the better. 🙂

 

https://forums.ni.com/t5/LabVIEW/Can-driver-for-SR830-and-SR844-be-used-interchangeably/m-p/1702554/...

Message 2 of 10
(309 Views)

Hi Mr. Jim,

 

I remember some of @'s posts about abusing control references in the "Rube Goldberg Code" thread:

 

https://forums.ni.com/t5/BreakPoint/Rube-Goldberg-Code/m-p/4296745#M33560

https://forums.ni.com/t5/BreakPoint/Rube-Goldberg-Code/m-p/4336745#M33703

 

Corresponding sources are linked in the comments.

 

Regards,

Raphaël.

Message 3 of 10
(306 Views)

I'm not sure what you're looking for specifically, but here are a couple of examples from the archive, which are bad code and use control references, although I'm not sure if this is the direction you're looking for. I don't know where the originals are from. You can try an image searching or searching for the names.


___________________
Try to take over the world!
Download All
Message 4 of 10
(272 Views)

The real abuse of references doesn't really capture well in a screenshot.

 

I'll see if I can capture something, but it won't be easy and might not help that much.

 

In short: I'm OK with putting references in a class so it can manage the controls. But if you do, do not ALSO use locals AND properties VI AND references in other classes AND pass references to subVIs (all from the main VI).

 

Getting the references by label in a subVI is understandable, but also makes things really hard to read. In the code I inherited, there wasn't even an error if the label wasn't found. So anyone (me) changing things wouldn't find out the mistake until much later. 

Message 5 of 10
(230 Views)

Hi guys, thank you all so much. I'm sorry I'm so late replying - I've been buried with my real job and I'm just now finishing this up.

 

 


@mcduff wrote:

I abused them when I was younger. I thought they were analogous to pointers in C. I have not seen this code in years, but I bet it has tons of control references. Just let people know I have changed for the better. 🙂

 

https://forums.ni.com/t5/LabVIEW/Can-driver-for-SR830-and-SR844-be-used-interchangeably/m-p/1702554/...


Oh, we all wrote code we are now embarrassed of. There's no shame in it, though I confess I have felt it in the past.

0 Kudos
Message 6 of 10
(126 Views)

@raphschru wrote:

Hi Mr. Jim,

 

I remember some of @'s posts about abusing control references in the "Rube Goldberg Code" thread:


Raphaël, this is perfect! Thanks!

0 Kudos
Message 7 of 10
(125 Views)

@tst wrote:

You can try an image searching or searching for the names.


I'm not trying to shame anyone, so I won't name the individuals who made these. 😉

I was only offering a shout-out to the people who made them available to me. (Thank you!)

 

Those are pretty hilarious. Good stuff.

0 Kudos
Message 8 of 10
(124 Views)

Graph.png

When I first started using LabVIEW, I thought wrapping a class around a graph reference was a fantastic idea. But as it turns out, it's terribly slow. Setting graph values by reference really isn't a good approach.

Actor Framework
0 Kudos
Message 9 of 10
(98 Views)

@Quiztus2 wrote:

Graph.png

When I first started using LabVIEW, I thought wrapping a class around a graph reference was a fantastic idea. But as it turns out, it's terribly slow. Setting graph values by reference really isn't a good approach.


It is fine if you don't use it for updating the values, but just for controlling the operation of the graph. James Powell has an example of such "Augments" using his messenger library and I think it is the basic idea behind QControls if I am remembering correctly.

0 Kudos
Message 10 of 10
(87 Views)