Mar-04-2021, 10:17 PM
I have one xml file (famtree.xml) that I read in, that holds many parameters about family tree data. It has many levels, root level is me, then parents, grandparents....
Now I am currently creating one class instance of that data: class myFamTree
Then I used to create (too many) class methods to return some data. get_own_parents(), get_parents_mom(), get_parents_dad(), get_parents_parents_mom(), get_parents_parents_dad(), etc.....
I feel this is getting too many methods. Is there any good practice how to clean code such scenario and avoid a superclass like here?
Now I am currently creating one class instance of that data: class myFamTree
Then I used to create (too many) class methods to return some data. get_own_parents(), get_parents_mom(), get_parents_dad(), get_parents_parents_mom(), get_parents_parents_dad(), etc.....
I feel this is getting too many methods. Is there any good practice how to clean code such scenario and avoid a superclass like here?