BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code


wiebe@CARYA wrote:

I keep wandering if there is a reason to put those constants outside the loop.

 

I don't think it's faster (anymore)? Is this just habit? Or preference?

 

wiebeCARYA_0-1650615685835.png

 

I personally prefer the constants inside the loop... Not looking for a flame war, just curious.

 


My preference would be the latter and this reflects @altenbach's reasoning precisely. I just have the habit of reducing as much free space inside the for loop, if the terminal is unused, I would move it to a corner or hide it (I guess this is a feature from LV2020).

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution
0 Kudos
Message 2371 of 2,635
(3,555 Views)

@santo_13 wrote:

wiebe@CARYA wrote:

I keep wandering if there is a reason to put those constants outside the loop.

 

I don't think it's faster (anymore)? Is this just habit? Or preference?

 

wiebeCARYA_0-1650615685835.png

 

I personally prefer the constants inside the loop... Not looking for a flame war, just curious.

 


My preference would be the latter and this reflects @altenbach's reasoning precisely. I just have the habit of reducing as much free space inside the for loop, if the terminal is unused, I would move it to a corner or hide it (I guess this is a feature from LV2020).


Since I usually set my ini file to the non-default "Show Created Constant Labels by Default" , I migrate the folded constants myself even though the compiler will "Rarely limit Optomizations" ( yes, I keep that option at a non-default 10 .)  It may make development time longer to document and migrate constants as written but I seldom have to be asked "What do they mean?"  It also makes them searchable.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2372 of 2,635
(3,538 Views)

@santo_13 wrote:

wiebe@CARYA wrote:

I keep wandering if there is a reason to put those constants outside the loop.

 

I don't think it's faster (anymore)? Is this just habit? Or preference?

 

wiebeCARYA_0-1650615685835.png

 

I personally prefer the constants inside the loop... Not looking for a flame war, just curious.

 


My preference would be the latter and this reflects @altenbach's reasoning precisely. I just have the habit of reducing as much free space inside the for loop, if the terminal is unused, I would move it to a corner or hide it (I guess this is a feature from LV2020).


I always try to minimize wire length and tunnels.

 

I usually like the constants as close as possible to where they're used.

 

Both strategies seem valid ways to achieve readable code.

 

I guess we all leave our 'signatures' in the code we make.

0 Kudos
Message 2373 of 2,635
(3,523 Views)

@santo_13 wrote:
[...] if the terminal is unused, I would move it to a corner or hide it (I guess this is a feature from LV2020).

Yes it is, also for the while loops and it is very enjoyable (imho) the only issue I have is that I would have preferred they put the option in "visible items" instead of making longer and longer menus.

VinnyLaTaupe_0-1650876146618.png

 

0 Kudos
Message 2374 of 2,635
(3,548 Views)

Yes, I always thought that the "conditional terminal" and the "iteration terminal" visibility option should be under the "visible items" section of the right-click menu. Similarly, these options are also missing from the properties page, which is quite anemic for FOR and WHILE loops.

 

 

0 Kudos
Message 2375 of 2,635
(3,523 Views)

I always hide them if they're not used. The old "less is more" cliché 🙄.

 

It doesn't work well when shrinking though (CTRL+ALT+drag). The iteration terminal disallows shrinking. A workaround is to shrink the other way, so it's not a big problem.

0 Kudos
Message 2376 of 2,635
(3,540 Views)

wiebe@CARYA wrote:
I usually like the constants as close as possible to where they're used.

 

Both strategies seem valid ways to achieve readable code.


Another example from here:

 

altenbach_1-1651080520574.png

 

 

 

 

0 Kudos
Message 2377 of 2,635
(3,429 Views)

@altenbach wrote:

wiebe@CARYA wrote:
I usually like the constants as close as possible to where they're used.

 

Both strategies seem valid ways to achieve readable code.


Another example from here:

 

altenbach_1-1651080520574.png


I don't think it's ugly inside the loop. It removes 2 wires and 2 tunnels and 4 terminals. Seems like an improvement to me.

 

If it where a control, it should of course be outside the loop for performance reasons.

0 Kudos
Message 2378 of 2,635
(3,385 Views)

To turn two booleans (from two "is value changed" vim) into an integer apparently takes six diagram constant, two selects, two comparisons, and two case structures and lots of orange!

 

How can that possibly be simplified???

 

(seen here)

 

altenbach_0-1651248423448.png

 

Message 2379 of 2,635
(3,321 Views)

@altenbach wrote:

To turn two booleans (from two "is value changed" vim) into an integer (0...3) apparently takes six diagram constant, two selects, two comparisons, and two case structures and lots of orange!

 

How can that possibly be simplified???

 

(seen here)

 

altenbach_0-1651248423448.png

 


This one took me quite a while to figure out what was going on.

Matt J | National Instruments | CLA
0 Kudos
Message 2380 of 2,635
(3,315 Views)