Sangel Kapoor wrote:I will be using Person Class in Family Tree.
Sex is Enum so immutable.
So, essentially Person Class will hold Age, Sex, Name, FamilyTree.
Junilu Lacar wrote:I don't think that's what Paul was getting at with immutable vs mutable but I'll defer to him to comment on what you said.
Sangel Kapoor wrote:Relationships could be SPOUSE, FATHER, MOTHER, SIBLING, SON, DAUGHTER etc
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Sangel Kapoor wrote:Another design thoughts is to make FamilyTree controller , which keeps track of Person in Application and their family trees.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:'Spouse' (at least in most Western countries) is a 1:1 relationship, so if Frank is Susan's spouse, he can't also be Nicole's.
Junilu Lacar wrote:Whatever it was that made you think that there are "two groups of opposing thoughts" here, that's a misperception on your part. Various options have been presented to you to make you think your design through and come up with a good justification for your decision. The giving of an option is not necessarily an endorsement of it. In fact, we expect that you would reject some of those options.
Sangel Kapoor wrote:Apologies for this, seems like there is some misinterpretation from your side, when I mean "two groups of opposing thoughts" , I mean here in my team :-)
Dave Tolls wrote:Divorce or death and subsequent remarriage should be taken into account. So, in a family tree sense, someone can have multiple spouses. You might end up writing a check to ensure dates don't overlap, but then you'd miss out on those juicy family secrets from way back when...you know, when Great Great Uncle Bob went off to sea, leaving Mrs Bob behind, and everyone thought he'd died...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Sangel Kapoor wrote:
What should I call to this class ? FamilyManager/ FamilyRegistrar ???
Also I am planning to remove "Family Tree" from Person and Injecting FamilyController(Wrong name!) instead. FamilyController would be Singleton and it holds all the Person and their familyTree's
Bear Bibeault wrote:In my opinion, the relationships are inherent in the tree structure and shouldn't be codified into attributes or classes.
Junilu Lacar wrote:
Bear Bibeault wrote:In my opinion, the relationships are inherent in the tree structure and shouldn't be codified into attributes or classes.
Exactly. Relationships between nodes (Person objects) can be calculated based on their relative positions within the tree structure. That's why a Strategy comes to mind. A "Simple" strategy can calculate relationships like Father, Mother, Brother, Sister, Sibling, Cousin, Aunt, Uncle, etc. Another Strategy might be able to calculate something like "Father's second Sister's fifth Son's first Daughter". This is why I'd start with the biologically-formed relationships and then add to that the social/legal relationships formed by marriage and adoption and figure out how to represent that in a tree structure.
Sangel Kapoor wrote:First of all it wont be a Tree Structure (Data Structure), it would be Graph.
Junilu Lacar wrote:It's not called a Family Tree for nothing. You might be confusing binary vs non-binary trees. What distinguishes a Tree from a Graph is the absence or presence of a cycle.
Paul Clapham wrote:But nevertheless a Family Tree isn't a Tree as computer scientists know it. Well, the part where you just have parents and children is a tree, but once you start inserting links for marital relationships you don't have a tree any more. As soon as somebody marries their niece (not an impossible scenario at all) you've got a cycle in your graph.
Junilu Lacar wrote:I'm sure there are computer scientists who have not been confined to thinking this way and have managed to elegantly represent those cases in a non-binary Tree structure.
Paul Clapham wrote:but I certainly wouldn't call them "elegant".
Junilu Lacar wrote:You can always compartmentalize being a father, a son, a brother, a cousin, etc. and be one thing or the other in different contexts.
Junilu Lacar wrote:The idea that Marriage is when Two become One is not just a romantic concept.
Junilu Lacar wrote:
Paul Clapham wrote:But nevertheless a Family Tree isn't a Tree as computer scientists know it. Well, the part where you just have parents and children is a tree, but once you start inserting links for marital relationships you don't have a tree any more. As soon as somebody marries their niece (not an impossible scenario at all) you've got a cycle in your graph.
I'm sure there are computer scientists who have not been confined to thinking this way and have managed to elegantly represent those cases in a non-binary Tree structure.
Wanna see my flashlight? How about this tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|