I am building a simple tool to help with some statistical analysis of a
sports site. I have the following:
class Player # just a wrapper around ostruct for read_only access
class Team # a collection of players
class League # a collection of teams
There are many ways I can “build” the league so to speak. I want to be
to build the league from a web site(scraping for information), from a
local access) and a file(for even more local access I suppose). Now I am
having a bit of a problem organizing a few things.
Should I have an abstract class Builder and derive WebBuilder,
and FileBuilder from it or should I just have different methods within
league class? If I were to make these separate classes, then the builder
class will have to somehow get the data back across to the League class
which actually builds the team. It feels a bit kludgy. I don’t want to
burden the Team and Player’s constructors with any more than just basic
assignments. Is this a bad idea?
And the bigger fish here is the web builder. The web builder has to
scrape a site with a list of teams, from which it goes to each team
and further fetches statistics by going to the player’s site. Its really
elementary to do, but again, where should it ideally fit?