NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Knight of NI
altenbach
Posts: 22,855

Re: 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. :smileysurprised:


LabVIEW Champion . Oh, by the way, I work for peanutsKudos .

Knight of NI
Knight of NI
Ben
Posts: 16,091

Re: Why some people say Local Variables are bad...

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

Ben Rayner
Who is NOT John Galt... yet... just building Rayner's Ridge

Knight of NI
Knight of NI
tst
Posts: 10,233
0 Kudos

Re: Why some people say Local Variables are bad...


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. :smileysurprised:


 

Whaddaya mean, "debug"?

___________________
Try to take over the world!
Knight of NI
altenbach
Posts: 22,855

Re: Why some people say Local Variables are bad...

[ Edited ]

tst wrote:
Whaddaya mean, "debug"?

"Delouse"?

  

 

Message Edited by altenbach on 10-07-2008 11:36 AM

LabVIEW Champion . Oh, by the way, I work for peanutsKudos .

Knight of NI
Ray.R
Posts: 10,165
0 Kudos

Re: Why some people say Local Variables are bad...


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

.
(starting to) See Life in a brand new way...

b* ^ )
Active Participant
yenknip
Posts: 492
0 Kudos

Re: Why some people say Local Variables are bad...


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

Active Participant
Wayne.C
Posts: 1,949
0 Kudos

Re: Why some people say Local Variables are bad...

Ed,

 

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

Member
RJay
Posts: 62
0 Kudos

Re: Why some people say Local Variables are bad...

I inherited code that has many Local Variables.  You should explain how to get rid of them. 
Knight of NI
Ray.R
Posts: 10,165
0 Kudos

Re: Why some people say Local Variables are bad...

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

.
(starting to) See Life in a brand new way...

b* ^ )
Active Participant
yenknip
Posts: 492

Re: Why some people say Local Variables are bad...

[ Edited ]

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 :-p

 

 Edit:  ^ Sorry Ray :-(

Message Edited by yenknip on 10-09-2008 02:03 PM
_____________________________
- Cheers, Ed

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page