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

Haven't seen these boolean NOOPs for at least a few hours :o, but sometimes they come in swarms. 😄

 

BooleanRube.png

 

(seen here)

 

 

0 Kudos
Message 1851 of 2,571
(10,824 Views)

@altenbach wrote:

Haven't seen these boolean NOOPs for at least a few hours :o, but sometimes they come in swarms. 😄

 

BooleanRube.png

 

(seen here)

 

 


There actually is a case where I would compare a Boolean to a Boolean (wire).  That would be if there is a requirement that states you need to check it against a Boolean value - and then the Boolean becomes P/F not T/F.  A subtle variation of this is if you are checking two clusters for equality.  If one of the elements compared happens to be a Boolean data type, you can't avoid the comparison.

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

@altenbach wrote:

Haven't seen these boolean NOOPs for at least a few hours :o, but sometimes they come in swarms. 😄

 

BooleanRube.png

 

(seen here)

 

 


It could make some sense during testing. Forcing the bottom item to be true with one click to test might be useful if you have to switch this a lot to test. Same for the selector. If you understand this trick you probably don't need to use it very often.

 

Also, if you are smart enough to apply this trick for testing, you should be smart enough to remove it when posting it or using it in production code. Or be prepared to lose some credit...

0 Kudos
Message 1853 of 2,571
(10,800 Views)

Can't resist:

 

There are 10 kinds of people, those work understand binary and those who don't.

Message 1854 of 2,571
(10,797 Views)

wiebe@CARYA wrote:
It could make some sense during testing. Forcing the bottom item to be true with one click to test might be useful if you have to switch this a lot to test. Same for the selector. If you understand this trick you probably don't need to use it very often.

 


There is nothing wrong adding a few injection points for debugging (I typically insert a control so I can actually change it during the test run), but the bottom (B) is not suitable for this, because you e.g. cannot force the result to be FALSE (you could add an "AND" with yet another diagram constant, but then the truth table becomes a bit convoluted). OTOH, the upper code can give all the possible outcomes (direct, always false, always true, flip) by changing the constants during debugging. But yes, leaving this code in is very dangerous, because it might be hard to remember what the natural states of the constants should be. Even remembering to always revert them might be hard.

 

Of course the "testing" argument  would no longer be valid if we had this old idea implemented. 😄

0 Kudos
Message 1855 of 2,571
(10,781 Views)

Look at all these local variables! (seen here)

 

simultaneously-motor-movement.png

 

0 Kudos
Message 1856 of 2,571
(10,695 Views)

@altenbach wrote:

Look at all these local variables! (seen here)


All those frames aren't very pretty either.

 

Just to save people a click on the original post: it's a plain sub VI. If it where a GUI, the locals would make some sense...

0 Kudos
Message 1857 of 2,571
(10,681 Views)

I had a project where this was copied all over the place:

Array Of Strings To String.png

Now if you don't know how to do that the easy way, at least make a subVI!

Spoiler
Array Of Strings To String 2.png
Message 1858 of 2,571
(10,680 Views)

I recently volunteered to do some code review for the local university's physics program.  The first sample I was given was a goldmine, but this is my favorite so far:

FSS Abuse.png

Best part is the bd objects are in different locations in each frame of the SSS so it was clear they didn't even hit "Duplicate Frame" each time.  They recreated from scratch the same code 20 times.

 

(Disclaimer:  this was most likely written by a grad student who had never seen LV before and was just told to make it work)

 

Message 1859 of 2,571
(10,645 Views)

@BowenM wrote:

... and was just told to make it work) 


And I guess it actually "worked" 😄

0 Kudos
Message 1860 of 2,571
(10,624 Views)