class size

Jeremy Bowers jerf at jerf.org
Tue Sep 21 14:43:09 EDT 2004


On Tue, 21 Sep 2004 14:15:10 -0400, Brad Tilley wrote:

> How large (lines of code) should a class be before one should split it 
> into smaller classes? Is there a general rule on this? How many 
> functions should a class contain? Are there limits (theoretical or 
> practical) that people learning classes should adhere to?

As long as the class is doing one thing (or as I prefer to think of it,
representing one concept), you're fine. I have classes that are 4 lines
long (and would probably be a one-liner in most other languages), and
classes 500 lines long... and that class has already had another couple
hundred lines cut out of it and put into other classes.



More information about the Python-list mailing list