OOP design question

phawkins at connact.com phawkins at connact.com
Mon Jun 25 12:10:41 EDT 2001


>>>>> "MW" == Michal Wallace <sabren at manifestation.com> writes:

MW> I could be wrong, but I think the your situation is better solved
MW> using composition (one object using/owning another) rather than
MW> inheritance.

I've always found the "is-a" and "has-a" descriptions a good way to
distinguish this.

Given two objects A and B, when considering whether A ought to be a parent of
B, or whether A ought to contain B, ask yourself:

is B an A?
or
does A have a B?


-- 
Patricia


Patricia J. Hawkins
Hawkins Internet Applications, LLC





More information about the Python-list mailing list