BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

Folks, let's remember that there's a separate thread for local variable abuse. This is supposed to be a thread about Rube Goldberg code. Using local variables where a wire can be used is not Rube Goldberg.
0 Kudos
Message 621 of 2,598
(11,637 Views)

Other example from the same project:

 

Enum is translated by wiring to a case and create a constant as output in each case.

Variables are transferred through globals, so to get guaranteed read/write order most everything is in sequences. One step to set a global than call a function that uses it.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 622 of 2,598
(11,616 Views)

Yamaeda wrote:

Some nice RGC. 🙂


I can see the person behind this VI, is from Sweden. Perhaps this may be regarded as a extenuating circumstance.  



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 623 of 2,598
(11,601 Views)

I'm moving into a new project at work and looking at the code. Here is one bit of code that I found:

 

The old code:

Old_Decision_Code.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

And the new code:

 

New_Decision_Code.jpg

 

 

 The new code runs much faster than the inner cases of the pyramid.

 

 

     Rob

Message 624 of 2,598
(11,542 Views)

bits.png

Nice-  but don't stop there!  Why oh why the splits and the detour through arrays of booleans just to convert back to a number.


 

Still a bit RG'y

Message Edited by Jeff Bohrer on 02-24-2010 03:01 PM

"Should be" isn't "Is" -Jay
0 Kudos
Message 625 of 2,598
(11,528 Views)

Need longer edit

bits.png

 

Missed a step- you only want new alarms


"Should be" isn't "Is" -Jay
Message 626 of 2,598
(11,535 Views)

You are correct. But I am curious - why 2 AND operations. ANDing a number with a mask and then doing it again seems redundant (a little RG).

 

     Rob

0 Kudos
Message 627 of 2,598
(11,515 Views)

Robert Cole wrote:

You are correct. But I am curious - why 2 AND operations. ANDing a number with a mask and then doing it again seems redundant (a little RG).

 

     Rob


You are correct- unless you want the "bits changed" - which I would keep for debug or extension purposes as it provides a detail that would be difficult to reconstruct from the output if I had just used And(Mask, Xor(New,Old)).  So the semi-redundant "and" is an appendix- not R-G. 

 

Which brings up a interesting point.  RG code is "overly complex code that outputs a set of values".  Having additional information that may not be used doesn't meet this definition.  An equivalency could be made to the Return count from VISA read.  Seldom used and it would be easy to get a strlen from the return but I does come in handy now and then.

 

Perhaps I'm splitting hairs but, (lacking a software specification) I would tend to produce outputs of any potentially intersting values.  My criteria for "Interesting" is any step I can easilly name. (e.g. "Current State", "Alarms", "Alarms Changed", ect....)


"Should be" isn't "Is" -Jay
0 Kudos
Message 628 of 2,598
(11,477 Views)

Jeff Bohrer wrote:

Perhaps I'm splitting hairs but, (lacking a software specification) I would tend to produce outputs of any potentially intersting values.  My criteria for "Interesting" is any step I can easilly name. (e.g. "Current State", "Alarms", "Alarms Changed", ect....)


Ok so you have a set of interesting values (lets assume that not all values are interesting).

So you have the set of interesting values, and of the non-interesting values based on the above there must be a first value (depending on the order you look at them) that is not interesting. The fact that it is the first non-interesting value, may itself be interesting, thus giving interest to the value and making it interesting. So you have a new set of interesting values........

Message 629 of 2,598
(11,454 Views)

Hornless.Rhino wrote:

Jeff Bohrer wrote:

Perhaps I'm splitting hairs but, (lacking a software specification) I would tend to produce outputs of any potentially intersting values.  My criteria for "Interesting" is any step I can easilly name. (e.g. "Current State", "Alarms", "Alarms Changed", ect....)


Ok so you have a set of interesting values (lets assume that not all values are interesting).

So you have the set of interesting values, and of the non-interesting values based on the above there must be a first value (depending on the order you look at them) that is not interesting. The fact that it is the first non-interesting value, may itself be interesting, thus giving interest to the value and making it interesting. So you have a new set of interesting values........


Smiley Very Happy

Nicely said!  and I belive you just argued my point "Code only by intention"   I admit it's spagettitish- I lack a clear definition of the use cases! More effecient code could be written given a broader picture of the intended use.   Or, not if the inteded use was broad. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 630 of 2,598
(11,432 Views)