3 ms·
You need an intermediate representation (like a tree) rather than attempt to brute force every possible permutation up until some arbitrary point. Even if that
by c3534l 7y ago
You need an intermediate representation (like a tree) rather than attempt to brute force every possible permutation up until some arbitrary point. Even if that weren't the case, it'd be better to give it a more obscure name or create some kind of naming system and then document it rather than demonstrate why self-documenting code can become self-defeating if taken to an extreme.
- masklinn 7y agoThe issue of a tree is you could trivially create nonsensical relationships. An alternative would be some sort of nested attributes / tag set but even that's not excellent. A second issue is, this is probably a localisation / cultural concern: below, yorwba notes that this relationship is a specific term in chinese kinship: https://en.wikipedia.org/wiki/Chinese_kinship#Common_extended_family_and_terminology https://en.wikipedia.org/wiki/Chinese_kinship#Common_extende....
- sansnomme 7y agoAnd generate the list using metaprogramming at compile time.
- jug 7y agoNot sure, but I sort of expected this monstrosity happens because the labels are intended to be localizable.
- ulrikrasmussen 7y agoWhy would an obscure name be better? This looks like an example where a very specific relationship is needed, and the name specifies precisely what that is. Choosing an obscure name for this feels like an attempt to hide the fact that this is a special case by using vague terminology.
- stevekemp 7y agoTrees can't be used for relationships, due to the crazy things that people can do with each other. You'll need a DAG, and you'll need to detect cycles. https://stackoverflow.com/questions/6163683/cycles-in-family-tree-software https://stackoverflow.com/questions/6163683/cycles-in-family...