On 19/08/17 17:00, boB Stepp wrote:

> I try to keep this in mind.  Another thing I'm currently struggling
> with is when to use inheritance vs. separate, independent classes.

The golden rule is if the child is not a kind-of the parent then
it should be delegation not inheritance. Never use inheritance as
a mechanism for construction, its for specializing types.

Another anti-pattern to look out for is if you are adding a lot
of new methods rather than overriding inherited methods there's
a good chance you are going the wrong way.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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

Reply via email to