BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

A Rube Goldberg Machine is defined as an "exceedingly complex devices that perform simple tasks in very indirect and convoluted ways"
 
 
One example would the the simplfied pencil sharpener.
 
Let's define Rube Goldberg Code as ""exceedingly complex LabVIEW code that perform simple tasks in very indirect and convoluted ways"
 
For example, let's have a look at the code to test if two booleans are equal. Just beautiful! 🙂
 
Unfortunately, the beauty of this is lost to most of you. 😞 To test this point, I have recently posted an obvious joke to see if anyone actually pays attention.... Apparently not!!! Nobody commented on my example that I snuck into the tic-tac-toe discussion. For comparison, here's my actual code detail compared to the posted image. 😄 Duuhhh!!!
 
 
 
Anyway, I am sure that most of you have some great examples of such code. This thread is the place to share the fun! 🙂
 
I am not really looking for intentional constructs (anybody can do that!). The focus should be more on existing serious code where you suddenly noticed that there is a much simpler way.
 
(Many code examples posted in the forum contain mini versions, e.g. the use of "delete from array" with "deleted portion" as the only output wired, used as a substutute for "array subset" seems quite popular ;))

Message Edited by altenbach on 08-03-2006 08:10 AM

Message 1 of 2,595
(59,701 Views)

I'm not making this up...the following was in a VI I was doing a code review on several years ago:

You'll all be happy to know this person no longer works at NI.

-D

Message Edited by Darren on 08-03-2006 01:03 PM

Message 2 of 2,595
(59,663 Views)

When I was "wee-G-Babe" I wanted to sort folders based their size.

I did not know about the "Cluster Sort" method so I coded up a variation on a bubble sort.

Greg McKaskle said he was stumped for a while but eventually figured it out.

This was one of the first "Bad" from the "Good the Bad and the Ugly" series.

Ben

Message Edited by Ben on 08-03-2006 01:47 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 2,595
(59,645 Views)
I am one of those sick bastards that actually enjoys straightening other people's spaggetti.  I have seen some impressive examples of Goldburg constructs.  Recently I ran across the gem in the top illustration.  To the guy's credit, in the original code the selects were nowhere near eachother.  The equality, however, is inexcusable.




Disclaimer: I am guilty of this sort of thing too.  In fact, some examples I have posted have glaring Goldbergs.

Altenbach, you have such an established guru reputation that I am sure many people assumed there was some obscure reason why you set the example up that way.  Especially in the highly optimized enviornment of a coding challenge.

Message Edited by jasonhill on 08-04-2006 10:00 AM

Message 4 of 2,595
(59,604 Views)

I think I saw a variation of this in PRIME.vi posted yesterday. As a bonus, it also contains Darren's construct inside the case structure. 😉

So how do we go about constructive criticism in these cases? I am sure a few nudges in the right direction can make a big difference. Still I am impressed that people with no obvious LabVIEW or general programming background  can get a fully working program together. 🙂

Message 5 of 2,595
(59,588 Views)
Hi there:

Here is a golberg code about activating a boolean after an enter,

Smiley Wink Sorry Altenbach..

Ton

PS which code was faster (first post)?

Message Edited by TonP on 08-04-2006 09:36 PM

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 6 of 2,595
(59,576 Views)
Search for the numerous implementations of exclusive radio buttons (before the native ones)
For example here chutla's implementation and the elegant solution of mine.

Do they still teach how to make truth tables?

Message Edité par JeanPierre le 08-04-2006 07:04 PM



LabVIEW, C'est LabVIEW

Message 7 of 2,595
(59,551 Views)

Ok, this is too good to pass up.  I do not mean to offend the original poster(s) but check out the following:

  1. Launch LabVIEW 8.0 (7.1 doesn't allow browsing web examples).
  2. Launch Example Finder.
  3. (You may need to click "Setup", click the Web tab, and increase your number of web hits to 50 or more.)
  4. Include ni.com examples.
  5. Browse into Fundamentals - Arrays and Clusters.
  6. Scroll to the bottom of the list and you'll see a few examples with globe icons and an orange user icon which indicate they were submitted by external users.

Among the 10 or so user-submitted examples in this category are two that are particularly noteworthy.

  • 2D Array to number of Rows and Columns.vi
  • 2D_Array_to_number_of_Rows_and_Columns - revised.vi

Before opening them, think about how you'd write a VI with this name...  For me, I was thinking Array Size followed by Index Array if you wanted them as scalars.  Both of the above VIs are equally effective, but I'm not sure that's how I'd teach someone to do it.  🙂  Definitely not too efficient.

Message 8 of 2,595
(59,488 Views)

In this thread

http://forums.ni.com/ni/board/message?board.id=170&message.id=222491&jump=true

I posted a method to copy the contents of a cluster to another cluster.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 2,595
(58,899 Views)


@Ben wrote:

In this thread I posted a method to copy the contents of a cluster to another cluster.


And here I was thinking that this code was supposed to copy an array of variants into the cluster... Smiley Tongue

___________________
Try to take over the world!
0 Kudos
Message 10 of 2,595
(58,882 Views)