(This is too hard to follow, so I'm just going to respond to Kent's subsequent email. If I missed anything from here, please quote it more reasonably)

Vincent Davis 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. Which means
I really need to play with function objects to understand how they are
passed down the layers

Simulation(GPA = random.gauss(50, 10), repeat = 100.....)
    MakeApplicants(GPA)
        Applicants(GPA)  # I need to make sure the GPA is calculated at each
applicant not back at Simulation.

DaveA
ask if it will always be random.gauss? No, I would like it to be anything
from a constant to a much more complex function)

DaveA
"I would caution you that each instance of RepeatMatch will then hold lots
of the other members, so keeping them around could be expensive"

This means they stay in memory? Is there a way to know how much room a
instance takes up, in memory or hard drive?
I could serialize them a save them to a sqlite when done with a simulation
correct? How is a questions for later.

"worried that you might find my responses too complex"
I am kinda working in a vacuum, with respect to python programing. Complex
and difficult are ok, The challenge is not knowing what I don't know. I need
to practice with function objects and run a few experiments still to make
sureI understand them.

DaveA and Kent Thanks for all your help, Vincent
To add a little more to what I am doing I am using CherryPy to host this
simulation. So the GPA function and other simulation variables can be
entered in a html form and passed to the Simulation class. Then I am
calculating results as well as using matplotlib to make some plots, these
results and plots then get show. I think I have most of the CherryPy stuff
figured out once I have the Simulations class setup to do the whole thing.
The only part with CherryPy I am still working on is displaying progress on
the browser as the simulations runs, it can take several minutes.

Thanks
Vincent Davis
720-301-3003

<snip>

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to