I am in a bit of a jam in deciding how to structure my class. What I have is a baseball player class and necessary attributes of:
- Player ID (a key from a DB)
- Last name
- First name
- Team
- Position
- Opponent
- about 10 or 11 stats (historical)
- about 10 or 11 stats (projected)
- pitcher matchup
- weather
- ... and a few more
Some things to break this down a little:
1) put stats in dictionaries
2) make a team class that can hold general info common for all players on the team like weather and pitcher match up.
But, I still have 10 attributes after this.
Seeing this (Class with too many parameters: better design strategy?) has given me a couple ideas but don't know if they're ideal.
1) Use a dictionary - But then wouldn't be able to use methods to calculate stats (or would have to use separate functions)
2) Use args/kwargs - But from what I can gather, those seem to be for variable amounts of parameters, and all of my parameters will be required.
3) Breaking up into smaller classes - I have broken it up a bit already, but don't know if I can any further.
Is there a better way to build this rather than having a class with a bunch of parameters listed out?