Python Forum
too many methods in class - redesign idea?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
too many methods in class - redesign idea?
#4
Then paraphrase. Post enough to provide insight into the issues you are having.

I suspect your data has too little structure, you are ignoring the structure it has.

I would expect a family tree to be a tree of people. In addition to information like birth date and place, a People has 2 parents, X siblings and Y children. To find your grandparents you ask for your parents, and then ask for their parents. To find your uncles you ask for your parents, ask for their siblings, and filter out those that are not male. To find first cousins you get your parents, get their siblings, get their children.

To do these kinds of queries you need very few methods. Mostly you need a way to take the result of a query, filter it, and us it in another query. This is the kind of thing that relational databases are really good at. If you put your family tree data into a database you might get all the functionality you need for free. Almost no programming required.
Reply


Messages In This Thread
RE: too many methods in class - redesign idea? - by deanhystad - Mar-05-2021, 09:01 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Class test : good way to split methods into several files paul18fr 4 405 Jan-30-2024, 11:46 AM
Last Post: Pedroski55
  Structuring a large class: privite vs public methods 6hearts 3 1,017 May-05-2023, 10:06 AM
Last Post: Gribouillis
  access share attributed among several class methods drSlump 0 1,039 Nov-18-2021, 03:02 PM
Last Post: drSlump
  a function common to methods of a class Skaperen 7 2,501 Oct-04-2021, 07:07 PM
Last Post: Skaperen
  Listing All Methods Of Associated With A Class JoeDainton123 3 2,296 May-10-2021, 01:46 AM
Last Post: deanhystad
  Special Methods in Class Nikhil 3 2,224 Mar-04-2021, 06:25 PM
Last Post: Nikhil
  cant able to make methods interact with each other in the class jagasrik 2 1,751 Sep-16-2020, 06:52 PM
Last Post: deanhystad
  Question about naming variables in class methods sShadowSerpent 1 1,963 Mar-25-2020, 04:51 PM
Last Post: ndc85430
  a class calling one of its own methods? Skaperen 1 1,795 Jul-21-2019, 04:43 AM
Last Post: Gribouillis
  Do objects get their own copy of the class methods? Charles1 1 2,058 Feb-02-2019, 04:40 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020