LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A Thing of Nightmares. Recommendations when reworking abhorrent code?

Solved!
Go to solution

@Bob_Schor wrote:

Here is the NightMare in LabVIEW 2015 ...

 

BS


LOL when I first opened it up I was like, "This isn't so bad," and then I scrolled left.



Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 11 of 68
(1,357 Views)

Thanks everyone for their inputs, they are much appreciated! 

 

Here is some additional info:

 

I am not an expert in the field, I have a general idea of how the system works, but really all I do is add and fix code as well as conduct technical research. I wish I had the background or at least the person who wrote the code to explain what the theory and reasoning is for this. Unfortunately I'll probably have to make assumptions or just cluster together things I assume are together. I am actually a chemist, but I'm making things work on the programming and physics end of this project. 

 

I have reason to believe this code was written circa 2004

0 Kudos
Message 12 of 68
(1,354 Views)

Ironically, I just re-opened it and was wondering if that's what everyone was thinking when first opened. Just looks like a lot of unused space until you scroll left.

0 Kudos
Message 13 of 68
(1,350 Views)

@etvg wrote:

Thanks everyone for their inputs, they are much appreciated! 

 

Here is some additional info:

 

I am not an expert in the field, I have a general idea of how the system works, but really all I do is add and fix code as well as conduct technical research. I wish I had the background or at least the person who wrote the code to explain what the theory and reasoning is for this. Unfortunately I'll probably have to make assumptions or just cluster together things I assume are together. I am actually a chemist, but I'm making things work on the programming and physics end of this project. 

 

I have reason to believe this code was written circa 2004


Bad code is capable of time travel with no loss in its badness.

 

Does it work?

 

If it works don't mess with it.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 14 of 68
(1,347 Views)

Granted I don't know who you work for but I was handed a similar piece of code (see attached) and told to update it for a completely different product and make the front panel presentable for a customer qualification visit. 

 

I flat out refused and started over.

 

Turning out a more robust program based on a proper programming architecture that is easy to maintain and has now become our lab's Qualification Platform. 

 

 

========================
=== Engineer Ambiguously ===
========================
Download All
0 Kudos
Message 15 of 68
(1,338 Views)

It does work. However while I am running experiments in the lab I usually sit down with the code and try to make it simpler. The whole code used to be written in this same manner as some of you have seen in previous questions (@altenbach @bob_schor), and I would like to continue to make it user friendly for the next guy, as I leave in six weeks. I suppose it can be seen as a challenge as well. 

 

Cheers

0 Kudos
Message 16 of 68
(1,334 Views)

@Ben wrote:

@etvg wrote:

Thanks everyone for their inputs, they are much appreciated! 

 

Here is some additional info:

 

I am not an expert in the field, I have a general idea of how the system works, but really all I do is add and fix code as well as conduct technical research. I wish I had the background or at least the person who wrote the code to explain what the theory and reasoning is for this. Unfortunately I'll probably have to make assumptions or just cluster together things I assume are together. I am actually a chemist, but I'm making things work on the programming and physics end of this project. 

 

I have reason to believe this code was written circa 2004


Bad code is capable of time travel with no loss in its badness.

 

Does it work?

 

If it works don't mess with it.

 

Ben


I agree here.  The worse it looks, the less you should fool with it.  Sometimes bad code depends on its "badness" to run "correctly", including stuff like race conditions.  For instance, once I cleaned up some communications routines so efficiently that there was an unknown race condition downstream that, due to the communications happening is less than one second instead of several seconds, was now reading stale data.

 

If something is that bad, I generally rewrite it and then compare the output(s) to the original code to make sure it's doing the same thing.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 17 of 68
(1,328 Views)

I probably could attempt to re-write the entire code; however, not having a background in programming, the hardware,  or physics to completely understand the theory could severely inhibit my ability to do so. This code is for measuring resonances of materials via a digital Resonant Ultrasound Spectrometer.

0 Kudos
Message 18 of 68
(1,322 Views)

I'm sure you are right on the race conditions, I had a crack at changing some stuff about a week ago and I was having some race conditions, then a scenario where it worked; however, for some reason the speed of the system was hamstrung. This led to me just scrapping that VI and going back to the old version. 

0 Kudos
Message 19 of 68
(1,318 Views)

Edit: Deleted due to double post.

0 Kudos
Message 20 of 68
(1,314 Views)