01-22-2019 12:58 PM
@paul_cardinale wrote:
@Bob_Schor wrote:
@paul_cardinale wrote:
Hmm. So the recommendation is ti always use a 12-pin connector, but never use more than 8 pins.PC: What, never?
BS: No, never!
PC: What, Never???
BS: Well, hardly ever ...
The main point was the advantage of the (NI-recommended) 4-2-2-4 Connector Pattern (with Error In/Error Out used consistently, and straight-line connections between sequential VIs). However, I've also read a number of books on modern program design/refactoring/SOLID principles (I confess that "S" is the one that's easiest for me to understand and remember). One that I read within the last two years had several sections on numbers of parameters for routines -- 0 was the best, 1 was OK, 2 was less good, and 3 or more were strongly discouraged. I have to confess I occasionally pass 8 connectors, but my current average is probably 6-7 (recall that I almost always have the lower corners filled with the Error Line ...).
H.M.S. Bob-a-Schor
Since I usually have no more than 3 in, 3 out, I most often use 4-4. If I need more, I step up to 4-1-4*, then 4-2-4*, then 4-2-1-4 or 4-1-2-4, then 4-2-2-4. Sometimes I even take a 3-2-x and rotate 90 deg. Worst of all, I don't even see anything wrong with doing all that. Attached are some of my VIs with unusual pinouts & icons.
Paul Cardinale
P.S. I think your sign-off should have been: Bob Schor, Captain H.M.S. Lab-a-VIEW
* Sometimes flipped horizontally depending on which are input and which outputs
Possibly the only defense I have to offer for 4-2-2-4 as "LabVIEW Best Practices" is that most built-in LabVIEW "generic" VIs will have this pattern, and when you create a new subVI - regardless of from scratch or (in later LV versions) from existing code, it will always be with a 4-2-2-4 connector pane.
It is a "de facto" standard, therefore (probably) a "LabVIEW Best Practice".
01-22-2019 04:25 PM
I ran some stats on vi.lib (20601 VIs):
01-24-2019 08:06 AM
I admit to being a bit of snob when it comes to standards but I do not think that we should look to the VIs in vi.lib as "good". Many of those have stayed the way they were in the early days before anyone really put any good thought into what it "Should Be" and largely answered the Q what does it "have to be". The VIs that have exactly as many icon connections as they have wires look a lot like... Select that code, create>> Sub-VI ... done!
NI could have changed the icon connectors over the years but it would have required extra functionality to handle the rewiring that would be needed when the code from an earlier version was updated. A lot chances to miss something and introduce flaws.
"Good Enough"
I a term that makes me cringe when exploring the work of previous remodelers and wire-workers.
But today the 4-2-2-4 is a case of the tail wagging the dog.
LVOOP includes wizards to create the accessors and methods. They are scripted from templates that are 4-2-2-4. While we can muck with the templates and choose different patterns and the wizards will handle it, what will break in the option to use accesors as property nodes. LV cannot handle that as far as the last time I looked.
For my part, LVOOP has had an influence on how my code looks and the 4-2-2-4 is just fine for me. It is a hell of a lot better than the old standard that my company decided on 25 years ago which was the "worst case less one" pattern.
The idea back then was that having to go through an application and do a "relink" for all instances of a VI because the icon pattern changes should be avoided at all cost. Instead they went with the over-sized approach and just let the extra connection go un-used.
Another fact that plays into the decision is a subtle one that as always seemed to far fetched to be believed was one that I observed when developing a benchmarking test used to compare various communications schemes and characterize the differences. SCRAMNet vs Ethernet, vs Serial etc.
The project used two high-end RT PXI with high-speed counter timers driven by a common high-speed clock. This let me establish a common time base across the tow machines. I then had to establish a base-line for a generic do-nothing sub-VI to figure out how long it took to call a sub-VI. That baseline was the subtracted from the time measured to call "do-something" sub-VI that used one of the comm methods being characterized.
While working out the timing of calling a sub-VI I found that it took more time to call a sub-VI that had "extra terminals". The test was completely repeatable with the VIs with more connectors always taking more time. At that time I was able to come up with an "average time per connector" that was consistent. If memory serves it was something on the order of 7 femtoseconds.
Not much to worry about most of the time but if you are doing something repeatedly and need all of the speed you can get, it is a factor that may play a role.
The ramblings of an old man are now done.
Ben
01-24-2019 08:21 AM
@Ben wrote:
. . .
"Good Enough"
I a term that makes me cringe when exploring the work of previous remodelers and wire-workers.
. . .
Ben
Paul Cardinale
01-24-2019 06:07 PM
You may eventually end up with "good enough" but never strive for it. I know people who do.