[Tutor] Deleting an instance of an object

Adam Cripps kabads at gmail.com
Fri Sep 24 09:36:15 CEST 2004


On Thu, 23 Sep 2004 10:56:50 -0700, Jeff Shannon <jeff at ccvcorp.com> wrote:
> Adam Cripps wrote:
> 
> >(Article is a subclass of Issue, which is a subclass of Title, which
> >is a subclass of MagazineCollection). Each instance of Article has an
> >attribute name (article.name).
> >
> >
> 
> I haven't looked closely at your code, but this strikes me as not being
> a very good design.
> 
<snip> 
> Hmmm... glancing at your code a bit more, it *does* look like you have
> internal collections of each subclass in the next-higher class, so it
> seems that you've got that idea down.  So why are you subclassing?   It
> looks like Article instances aren't using any of the MagazineCollection
> code or the Issue code (and sharing code is the main benefit of
> subclassing), so it seems to me that this provides no benefit...   You
> can probably make each subclass a fully independent class, with no
> subclassing involved, without requiring any significant changes to your
> code.
> 
> Jeff Shannon
> Technician/Programmer

Jeff, 

Thanks very much for the feedback - very useful and provides a lot of
food for thought. It's this kind of community feedback that makes
Python so enjoyable to use.

This is the first program where I've used OO strictly, and so I'm not
completely clear why I made them subclasses. I think you're right -
they don't need to be. I'll try and make the changes later this
evening (UTC), wife permitting ;-)

Thanks again
Adam
--
proj: http://jiletters.sf.net
site: http://www.monkeez.org
wiki: http://wiki.monkeez.org


More information about the Tutor mailing list