I encountered a scenario where I cannot decide on which is the best (or worst) naming strategy. The context is the following: a bracket (as in a tournament) made up of nodes, where is node is made up of two abstract elements which can be a seeded player, a bye, or a reference to another node.
We clearly see a hierarchy of inclusion, conceptually speaking:
Bracket > Node > Element = Seed, Bye, Reference
I cannot decide whether name them with composed names and declare each class at the same level (no nesting):
class Bracket: pass class BracketNode: pass class BracketNodeElement: pass class BracketNodeElementSeed(BracketNodeElement): pass class BracketNodeElementBye(BracketNodeElement): pass class BracketNodeElementReference(BracketNodeElement): pass
Or wheter be a bit more DRY with the names but making the name arguably uglier:
class Bracket: class Node: class Element: pass class Seed(Element): pass class Bye(Element): pass class Reference(Element): pass
Accessing a seed or a bye must be expressed this way:
What is the usual way to go?