02-22-2010 08:57 AM
02-22-2010 10:18 AM
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.
02-22-2010 10:52 AM
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.
02-24-2010 12:58 PM
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:
And the new code:
The new code runs much faster than the inner cases of the pyramid.
Rob
02-24-2010 02:53 PM - edited 02-24-2010 03:01 PM
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
02-24-2010 03:07 PM
Need longer edit
Missed a step- you only want new alarms
02-24-2010 04:52 PM
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
02-25-2010 08:47 AM
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....)
02-25-2010 03:21 PM
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........
02-25-2010 08:03 PM
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........
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.