Hello,
Design Patterns is the key for code reuse and problem solving. Indeed
you have to separate your objects (classes) to use
it. The god class is like a script with only one function: not very
flexible and easy to debug.
Program towards interface that means you have to use inheritance.
Try to determine the objects you need for your problem and next step is
how arrange it together (relational).
Regards
Karim
On 01/26/2011 01:28 AM, Marc Tompkins wrote:
On Tue, Jan 25, 2011 at 3:26 PM, Elwin Estle<chrysalis_reb...@yahoo.com> wrote:
Is it better to have one large sort of "do it all" class, or break the larger class up
into smaller classes? Seems to me like the one large class would be clearer in some ways. I have
something I am trying to do that have somewhere in the neighborhood of 20 attributes that all
relate together, however there are sort of "clumps" of attributes that have a
sub-relationship to each other and I wondered if they should be their own class, but I am not sure,
assuming that is a good idea, how these smaller classes might work together. I have only the
foggiest notion of inheritance and I'd kind of like to stay away from that aspect of things until I
get a better grasp of individual classes.
For me, the question of one big class/multiple smaller classes comes
down to reusability.
If you find yourself writing the same code over and over again (or
cutting/pasting big blocks of code), you should probably break up your
classes.
--
www.fsrtechnologies.com
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor