BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

Altenbach,

 

I'd argue that example is not truly a Rube Goldberg, but definitely belongs in the Why some people say Local Variables are bad... thread.

0 Kudos
Message 1431 of 2,625
(10,600 Views)

I agree with RF..  🙂

 

By the way... the seen here link simply opens the image... not the thread where it is discussed.

0 Kudos
Message 1432 of 2,625
(10,577 Views)
0 Kudos
Message 1433 of 2,625
(10,564 Views)

I don't know.. there's a lot of RG there:

 

Lets see.. take a number. take an equals compairison of it with itself. AND with the same number equal to zero. Instead of just checking if number equals zero.

 

Repeat 5 times.

 

I'm sure there's more in the case statement but I don't see the other case so won't comment on that.

 

plus. I love that we have to write 13 to %IVA every time through the loop.


@altenbach wrote:

Ouch! (seen here)

 




 

 

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

0 Kudos
Message 1434 of 2,625
(10,556 Views)

@bsvare wrote:

I don't know.. there's a lot of RG there:

 

Lets see.. take a number. take an equals compairison of it with itself. AND with the same number equal to zero. Instead of just checking if number equals zero.

 

Repeat 5 times.

 


Still not really a Rube Goldberg.  A RG is having a structure that does the job, but takes far more steps than necessary.  You could probably simplify this code a bit, but in the end it still doesn't do anything.
It really is an abuse of local variables.  My gut feel is that they were trying to detect when the control had changed, then proceed to do something.  (Using google translate on the original message mentioned something about it being a vending machine app.)  But when you are programmer, and you have no clue as to what it is you are really trying to do and how to lay out the logic of it, the obvious solution is to just throw in more local variables and hope that the code magically starts working the way you want.
0 Kudos
Message 1435 of 2,625
(10,548 Views)

That diagram makes me hungry!

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 1436 of 2,625
(10,548 Views)

@bsvare wrote:

I don't know.. there's a lot of RG there:


I agree. I summarized my own finding here. We really need to see the actual VI. Another RG point is scalability. Imagine if they would need to expand that restaurant app (or whatever that is). to 200 items in the future.

 

(But yes, it also has a place in the local variable thread, but I thought there is no need to create duplicate posts. I thought the RG'ness was dominant here :D)

 

0 Kudos
Message 1437 of 2,625
(10,531 Views)

This is the case of a Rube Localsberg...  Code abuse that involves Local Variables.

 

Posting in both threads is okay, since there is abuse in both forms of code (overcomplexity and Locals).

Message 1438 of 2,625
(10,497 Views)

Perhaps a suitable posting strategy would have been to have a post in the RG thread linking to the local variables thread, in which there's a post linking back to another post regarding the VI in the RG thread?

---
CLA
0 Kudos
Message 1439 of 2,625
(10,461 Views)

The poster in this thread any examples of vi scripting an array??. seems to want to reshape a 2-D array to a 3-D array.  (not sure because thread hasn't be resolved yet.).

 

The catch to this thread wasn't just using code that looks like below as a RG for reshaping array.  The bigger RG is asking to use VI scripting to programmatically build the Rube Goldberg.

 

Message 1440 of 2,625
(10,381 Views)