Just to be clear,or try, given a set of applicants and institutions the Match will always have the same result. So when I am repeating the Match this only makes sense to do is I am also making new applicants and institutions. So I am sampling Match results drawn from a process that is initiated with a distributions set at the applicant and institution level.
Thanks Vincent Davis On Sun, Nov 1, 2009 at 9:58 AM, Kent Johnson <ken...@tds.net> wrote: > On Sun, Nov 1, 2009 at 10:47 AM, Vincent Davis <vinc...@vincentdavis.net> > wrote: > > Kent Johsnon writes > > "This class has a lot of responsibilities: > > - create applicants > > - create institutions > > - run a single match > > - run multiple matches > > - calculate statistics on the result of multiple matches > > A principle of object-oriented design is that a class should have a > > single responsibility. I would break your class up a bit using > > multiple classes, perhaps." > > I am trying to do what you recomend, as much as makes sense to me, but > that > > is why I ask the question so I should consider your answer. > > This is what I hear you saying, (I don't mean to represent them as > > sub-classes but more how they would operate on each other) Should I > consider > > making Institutions) a subclass of (Make Institutions)? I can't think of > > anything that would make sense to inherit. > > class Simulation: > > class Create Institutions: > > class Institutions: > > class create Applicants: > > class Applicants: > > class Match: > > class Multi Match: > > I add I am thinking > > class Simulation: > > def__init__:(self, results, stats.....repeat..) > > def create_applicants(): > > class Applicants > > def creat_institutions(): > > class Institutions > > def one_simulation(): # one or more > > create_applicants() > > create_institutions() > > class Match() > > class Results > > def repeat_simulation() > > repeat one_simulations > > class Results > > After writing this out I now think you are right, more classes. > > Now you are getting too complicated. You don't need to use inheritance > or nested classes, and you can use simple methods (not classes) to > create applicants and institutions. You already have Applicant, > Institution and Match classes that run a single match. Now make a > RepeatMatch class that uses the Match class to run multiple > simulations. > > Kent >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor