BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Why some people say Local Variables are bad...

It is scary is to think of how many work hours went into things like that.

 

First to wire it up, and then to debug it. 😮

Message 71 of 396
(12,497 Views)

After looking at these last two examples and experiencing my stomach turn when I saw them, I think that NI should cobble together these with a bunch of similarly attrocious examples into a short movie that they force students in LV basics I entitled "Death on the Wire-way" (like the movie they make people in drivers ED sit through).

 

Now where did I leave my Prilosec?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 72 of 396
(12,485 Views)

altenbach wrote:

It is scary is to think of how many work hours went into things like that.

 

First to wire it up, and then to debug it. 😮


 

Whaddaya mean, "debug"?

___________________
Try to take over the world!
0 Kudos
Message 73 of 396
(12,477 Views)

tst wrote:
Whaddaya mean, "debug"?

"Delouse"?

  

 

Message Edited by altenbach on 10-07-2008 11:36 AM
Message 74 of 396
(12,473 Views)

yenknip wrote:

I just did a search for all instances of a variable, it came up with 537 occurrence :smileysurprised:


Holy Caramba!  The code looked like a microscopic horror...    It's beyond nightmare..  Beyond the Locals nightmare..

 

Yikes..  Are you actually stuck fixing that?

 

R

0 Kudos
Message 75 of 396
(12,457 Views)

@JoeLabView wrote:

Holy Caramba!  The code looked like a microscopic horror...    It's beyond nightmare..  Beyond the Locals nightmare..

 

Yikes..  Are you actually stuck fixing that?

 

R


 

The thing is, it seems to work. Albeit the initialisation may not necessarily happen first :-S

 

I keep finding things to do to avoid touching it - when I finally do get round to it, I'm going to try and do as little as possible to anger the demons. All that needs to be added is flipping a digital output on the fieldpoint now and then. Hey, I could add a whole new while loop for it!

_____________________________
- Cheers, Ed
0 Kudos
Message 76 of 396
(12,487 Views)

Ed,

 

Ouch!  Looks like you need to ask for a wall of monitors just to get a good look at it.

0 Kudos
Message 77 of 396
(12,470 Views)
I inherited code that has many Local Variables.  You should explain how to get rid of them. 
0 Kudos
Message 78 of 396
(12,442 Views)

This thread is not to discuss how to solve or eliminate Locals.  It would be a lengthy discussion.  It is to show examples of Local Variable abuse.  It is not to say that they are indeed bad.  But become bad when abused.  Maybe the title is misleading.

 

Typically, there is a link to the thread that discusses the code where the example originated from.  Follow the link and you can read the suggestions that are offered.

 

R

0 Kudos
Message 79 of 396
(12,439 Views)

RJay wrote:
I inherited code that has many Local Variables.  You should explain how to get rid of them. 

More often than not, it's better to just rewrite it all from scratch, using an architecture that won't fall over. However, if time constraints are more important, then I'd just quetly add another butress and not claim to have added it 😛

 

 Edit:  ^ Sorry Ray 😞

Message Edited by yenknip on 10-09-2008 02:03 PM
_____________________________
- Cheers, Ed
Message 80 of 396
(12,437 Views)