You have a class hierarchy:
D extends C which extends B which extends A, for example.
A would be the top class, but how about D? I am looking for a short and concise way of describing the position of D within the hierarchy
Is it the most specific class? the deepest class in the hierarchy? the last subclass? final class?
The class might or might not be final (java) or sealed (c#). what matters is that it is the last one of the hierarchy at a particular moment. If a newer class (E) appears that extends D then the proposed term would apply to it. Also, there might be more than one class that fit this description (both D and E extends C), the term should apply to both classes.
-
6Unless D is sealed/final, I perhaps wouldn't give it a specific name since it might not be the end of the hierarchy.Telastyn– Telastyn2012年06月13日 13:47:53 +00:00Commented Jun 13, 2012 at 13:47
-
1Depending on the depth of the hierarchy, it could quite possibly be called a code smell or bug. ;)Max– Max2012年06月13日 13:50:06 +00:00Commented Jun 13, 2012 at 13:50
-
@Max. I am aware of that. the depth is actually quite big, so yes. it is smell. Still, I need the term for a document I am writingsantiagozky– santiagozky2012年06月13日 13:57:13 +00:00Commented Jun 13, 2012 at 13:57
-
I added a few more details about the final/sealed thingsantiagozky– santiagozky2012年06月13日 14:15:23 +00:00Commented Jun 13, 2012 at 14:15
4 Answers 4
How about the "last descendant" - if you're documenting something, just set out your terminology at the beginning or in a glossary.
-
I like this one. the answer from Jason is nice, but I think last descendant is more explicitsantiagozky– santiagozky2012年06月13日 15:33:15 +00:00Commented Jun 13, 2012 at 15:33
How about leaf class? http://en.wikipedia.org/wiki/Leaf_class
If you think of a base class as a "root" class, then the derived classes in the middle as branches, then calling these end/final classes "leaf" classes would make sense, no?
-
+1 this seems like a good candidate, although 'leaf' is more commonly used to refer to 'leaf nodes' in a tree structure. I'm not sure how universal the idea of a 'leaf class' is.MattDavey– MattDavey2012年06月13日 14:04:23 +00:00Commented Jun 13, 2012 at 14:04
-
@MattDavey, Yeah, I wish there was a more common term for a class that just so happens not to be extended but is not using a language feature like
final
orsealed
programmer– programmer2012年06月13日 14:18:06 +00:00Commented Jun 13, 2012 at 14:18 -
4In the absence of multiple inheritance, a leaf class is a leaf node in a tree structure.Jörg W Mittag– Jörg W Mittag2012年06月13日 17:17:57 +00:00Commented Jun 13, 2012 at 17:17
I would use "most derived class", but that's probably because I spend entirely too much time reading the C++ standard, and that's the term it uses.
I doubt there's one term that applies equally well across languages and uses though. In C++, the accepted terms are "derived class" and "base class", so "most derived class" makes sense.
In Smalltalk, by contrast, the accepted terms are "superclass" and "subclass", so trying to use "most derived class" would seem odd, foreign, and quite possibly at least mildly confusing (but no, I don't recall Smalltalk documentation having a specific term that corresponds to "most derived class").
the deepest class in the hierarchy
Does it mean , this class can't be extended any further? If yes, We call that as final
class java.
-
1I need the term for the class that is the deepest at a particular moment. if D is extended by E, then how will I call E?santiagozky– santiagozky2012年06月13日 14:09:22 +00:00Commented Jun 13, 2012 at 14:09