LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Which Classes Should Have Which Methods?

Solved!
Go to solution

@cbutcher wrote:

For ease of clicking, the link above should probably be this one: thols' link (What are the advantages of Composition and Aggregation over Inheritance?)


Interesting that the article conflicts itself:


Advantages of object composition and aggregation over inheritance

  • A design based on object composition usually will have less classes.

Downsides of composition and aggregation are:

  • A design based on object composition usually will have more objects.

In the end, I think just having the right relationship is what matters most (is a = inheritance, has a = composition).  Anything in the middle is a nightmare waiting to happen.



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 21 of 24
(540 Views)

I'd guess the suggestion is that a class is a template for objects whilst an object is an instantiation of a class.

If you have lots of objects as private data members of your class, you can conceivably imagine a situation in which the number of objects rises even as the number of classes falls (particularly if you would otherwise have multiple levels of inheritance leading to significant numbers of "abstract" or abstract-like classes that are never instantiated (either as a language limitation/constraint, or just practically as in LabVIEW)).

 

Despite the above paragraph (seemingly defending the article) I still wouldn't necessarily say I think it's stunningly well written or overly insightful. Without some knowledge of the author I'd be tempted to point out that (like for example, all of my posts in this thread, more or less) the author is just rehashing what others have already said/written elsewhere in a less convincing fashion.

 

I quite like the first 3 summary points, which give an overview of the comparison. I'm not sure the 4th is really supported by the article contents, even if it might be true (in some cases).


GCentral
0 Kudos
Message 22 of 24
(527 Views)

@crossrulz wrote:

@cbutcher wrote:

For ease of clicking, the link above should probably be this one: thols' link (What are the advantages of Composition and Aggregation over Inheritance?)


Interesting that the article conflicts itself:


Advantages of object composition and aggregation over inheritance

  • A design based on object composition usually will have less classes.

Downsides of composition and aggregation are:

  • A design based on object composition usually will have more objects.

In the end, I think just having the right relationship is what matters most (is a = inheritance, has a = composition).  Anything in the middle is a nightmare waiting to happen.


Those are not conflicting statements. A class != object. The class is the definition/description. An object is a concrete instance of a class.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 23 of 24
(515 Views)

@Mark_Yedinak wrote:
Those are not conflicting statements. A class != object. The class is the definition/description. An object is a concrete instance of a class.

Yeah, I misread it this morning.  Too many other things happening.



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 24 of 24
(505 Views)