4

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.

4
  • 6
    Unless D is sealed/final, I perhaps wouldn't give it a specific name since it might not be the end of the hierarchy.
    – Telastyn
    Commented Jun 13, 2012 at 13:47
  • 1
    Depending on the depth of the hierarchy, it could quite possibly be called a code smell or bug. ;)
    – Max
    Commented 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 writing Commented Jun 13, 2012 at 13:57
  • I added a few more details about the final/sealed thing Commented Jun 13, 2012 at 14:15

4 Answers 4

3

How about the "last descendant" - if you're documenting something, just set out your terminology at the beginning or in a glossary.

1
  • I like this one. the answer from Jason is nice, but I think last descendant is more explicit Commented Jun 13, 2012 at 15:33
21

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?

3
  • +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
    Commented 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 or sealed
    – programmer
    Commented Jun 13, 2012 at 14:18
  • 4
    In the absence of multiple inheritance, a leaf class is a leaf node in a tree structure. Commented Jun 13, 2012 at 17:17
2

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").

0

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.

1
  • 1
    I 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? Commented Jun 13, 2012 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.