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.

BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

Ran into this code today and it seems to be screeming Rube Goldberg.  Any comments?

 improveCode.png

 

0 Kudos
Message 1731 of 2,571
(10,420 Views)

I'm not seeing what the simpler alternative would be for this to be a Rube.  Looking at it for a minute or so, it doesn't seem bad.

0 Kudos
Message 1732 of 2,571
(10,393 Views)

@Ray.R wrote:

Ran into this code today and it seems to be screeming Rube Goldberg.  Any comments?

 improveCode.png

 


Sorry Ray but I am with Bill and can not point the RubeGoldbergness of that code. It some ways it is rather clever way to get the index (plus 1) of all of the true bits in a cluster of booleans.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 1733 of 2,571
(10,385 Views)

Ray.R wrote: improveCode.png

 


The only thing Rubish I see is perhaps the cluster could have been an array from the beginning.  But there are often good reasons for the cluster.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 1734 of 2,571
(10,382 Views)

Thanks guys!

 

I am always looking for ways to improve my code.  🙂

0 Kudos
Message 1735 of 2,571
(10,308 Views)

Snap of portion of code

Rube Goldberg Code.PNG

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 1736 of 2,571
(10,278 Views)
What is happening before element 3 in the initial code? Does the equals just not have anthing attached to its output?
Matt J | National Instruments | CLA
0 Kudos
Message 1737 of 2,571
(10,262 Views)

Actually its a part of complexcode, just portion of it i thought to share, the output will be passed to another loop.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 1738 of 2,571
(10,258 Views)

I would even build the rows 2&3 into a 2D array of strings (or use subset array), do only one single spreadsheet conversion, then index the rows out at the end.

 

I am also questioning the sanity of using binary formats for DBL. That's typically a thing for integers so maybe the type should be a blue array. Where is the output used?

 

Of course all output terminals should have self-explanatory names. Most seem to be at the defaults.

0 Kudos
Message 1739 of 2,571
(10,244 Views)

You know, this is mainly a fun thread, but we could use it as an excellent tool to post what we think is Rube-ish code and see if anyone can help us un-Rube it.

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 1740 of 2,571
(10,238 Views)