From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-11-2012 08:02 AM
I'll add to this thraed as well so we can say we have at lest 50 years of LabVIEW experience all telling you the same thing.
THere are two issues Spagetti and a Race Condition.
Both of those type of problem can be solved by using sub-VI's. The sooner you get used to being able to create and use Sub-VI, the sooner your code will turn the corner toward reliabilty and ease of maintenance.
Take a quick look at the inmages I posted in this albumn to get an idea of how sub-VIs can clean-up your code.
In your case you should first select parts of your code that do something that you can describe with a short title. That portion should be come a sub-VI. Use Type definitions for clusters to make you life easier.
For those potential sub-VI that get the data from a local, use an Action Engine to store the data (Thanks Bill for the mention and link earlier). Action Engines in wrappers (read that thread on Action Engines) is one of the single things yo can do that is most effective in cleaning up your code. Action Engines (AEs) store the data inside them so the "wires" you want to avoid seeing are encapsulated in the AE.
In general...
Unlike other langauges that insist you name everything that stores data, LV stores its data in un-named wires. Locals look like data storage thingies for non-LV developers but they are not. They should be viewed as an I/O device that are used to get info in or push it out. Miss-using locals lead to Race conditions as you have discovered.
Done adding to the pile while trying to help,
Ben
05-11-2012 08:16 AM
Good explanation Ben I guess atleast now iCat will stop to argue and understand the fact. Its always good to argue on some statement that is worthy and thats not been discussed. (If already done then pull that sub vi into this main vi and use it )
05-11-2012 09:53 AM
@iCat wrote:The screenshot of my code reminds me of sparse spaghetti.
Naw, it could look much more like spaghetti.
05-11-2012 04:35 PM
@Steve Chandler wrote:
@iCat wrote:The screenshot of my code reminds me of sparse spaghetti.Naw, it could look much more like spaghetti.
Looks like the code I just cleaned up. The original author did not believe in Sub-VIs and was married to the stacked sequence structure! Imagine having to hunt through something that was four 1280 x 1024 panels big with a main stacked sequence of 5 frames with myriads of smaller stacked sequences inside - like a stacked sequence fractal! 😄
Don't understand the philosophy at all. I wouldn't ever write text-based code with all my code in the main().
05-11-2012 05:51 PM - edited 05-11-2012 05:55 PM
@billko wrote:
@Steve Chandler wrote:
@iCat wrote:The screenshot of my code reminds me of sparse spaghetti.Naw, it could look much more like spaghetti.
Looks like the code I just cleaned up. The original author did not believe in Sub-VIs and was married to the stacked sequence structure! Imagine having to hunt through something that was four 1280 x 1024 panels big with a main stacked sequence of 5 frames with myriads of smaller stacked sequences inside - like a stacked sequence fractal! 😄
Don't understand the philosophy at all. I wouldn't ever write text-based code with all my code in the main().
I really am ROTFL-
\
Stevev, You should be ashamed!
05-11-2012 06:09 PM
The nice young men in the clean white coats.....