LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is your tolerance for placing things into clusters?

I'm curious.  I am a kind of OCD - and LabVIEW REALLY feeds it - and I tend to want to put related things into clusters, which isn't a bad thing, really.  But a lot of the things I incluce are already clusters, so there are quite a few levels of unbundling.  The question is, where is your tolerance between the need for organization and the pain of having huge unbundle by name nodes?  I try to make the labels simple and use captions wherever possible, but it still leads to some nasty unbundle by names, even if I unbundle directly instead of one level at a time.

 

If I let my tendencies run amok, I would end up with one big cluster of everything.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 1 of 26
(4,225 Views)

Have a look into LV Classes. Encapsulation is a great aspect of them, and using the access scope properly can enforce proper control over data mutation.

_____________________________
- Cheers, Ed
Message 2 of 26
(4,220 Views)

I can already hear certain people: "What are clusters?  Why aren't your using OOP?"

 

Personally, I usually have very few things in my clusters.  Usually a command with data.  Anything more complicated than that is usually not found in my code.

 

If things were going to get big and complicated, that is where classes come into play and make life simple.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 26
(4,209 Views)

@yenknip wrote:

Have a look into LV Classes. Encapsulation is a great aspect of them, and using the access scope properly can enforce proper control over data mutation.


Sure, but the flip side of things.  I don't think every cluster should become a class.

 

Cluster creation really just depends on the developer.  Not too many, not too few.  If things can be organized into groups, and those groups are commonly used in subVIs, by all means make a typed cluster.  There are plent of times where I have clusters of clusters, where both clusters are typed.  But if I know my data is only used in one subVI and not shared, I likely won't group it into a cluster.

0 Kudos
Message 4 of 26
(4,202 Views)

There are very few places I would use a cluster over a class.

Organising things into groups which use a common typedef cluster, is pretty much the definition of a methods of a class.

 

Nested clusters invariably lead to a hierarchical class based data structure. You can also avoid nested Cluster.SubCluster.Data bundle/unbundle operations by just calling a parent getData method on the child class.

 

Lastly, as I mentioned, is the access restrictions. Allowing access the whole bundle / unbundle data of a cluster is bad practice.

_____________________________
- Cheers, Ed
0 Kudos
Message 5 of 26
(4,191 Views)

Didn't know this would lead to a war between factions.  By all means, though - please continue.  It's a very interesting discussion.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 6 of 26
(4,182 Views)

@billko wrote:

Didn't know this would lead to a war between factions.  By all means, though - please continue.  It's a very interesting discussion.


No no no. It's not a war 😛

 

My background is in C++, so I came to LabVIEW with (what I consider) a strong understanding of objects, pointers, and memory allocation. Classes and abstraction is how my brain works.

_____________________________
- Cheers, Ed
Message 7 of 26
(4,171 Views)

Interesting you should ask....

 

The current project involves finishing a system originated by another developer where I have wires that I can hover over ON MAIN.VI with the wiring tool and my screen is not tall enough for the help window.

 


This is a sign that the system was designed with poor abstaction, no data hiding, and zip for encapsulation.  LVOOP can useful but, simply replacing "Clustersaurus" with "God Object" does not remove the "Code Smell."

 

The links should give you a place to start rethinking how to apply OOP programming principles in LabVIEW even if you don't need LVOOP to apply those principles.  


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 26
(4,160 Views)

@billko wrote:

Didn't know this would lead to a war between factions.  By all means, though - please continue.  It's a very interesting discussion.


I'm used to listening to both sides.  It can get fun listening to a bunch of CLAs argue over things like this.

 

In general, I have found those with a CS background like OOP while those with an engineering background do not and therefore work with clusters.  Though I am an Electrical Engineer, I find myself moving towards the OOP here and there.  It depends on my application.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 26
(4,156 Views)

LOL I meant a friendly war.  🙂

 

Well, it's all about evolution, you know?  Learning something then applying it.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 26
(4,151 Views)