Replace Whole Object Through Object Method

digitalorganics at digitalorganics at
Tue Jun 27 04:40:52 CEST 2006

Maric Michaud wrote:
> Le lundi 26 juin 2006 22:37, digitalorganics at a écrit :
> > Won't work because there will be employers that aren't workers.
> > And yes, only some workers will become employers, but also only some
> > employers will also be workers (at some point in program). Let me be
> > more clear:
> >
> > workers
> > --> subset of workers --become--> employers
> > employers
> > --> subset of employers --become--> workers
> >
> > It is very important that both should maintain attribute values,
> > regardless of whether they take on new "roles". Furthermore, this is a
> > very simple case and ultimately in my program an object should be able
> > to dynamically take on a multitude of roles (classes of behavior)
> > without mucking at all with their pre-existing states.
> This seem to be a OO design problem and you clearly make a misuse of
> inheritance, if a person can eventually have many roles, but doesn't have
> this role for all his lifetime, then the person *is* not his roles.
> That the meaning of inheritance, class B(A) means a B is a A.
> The association between a person and his roles is obviously a 1-n association,
> which can be rendered by different patterns (delegation, composition,
> strategy, etc.).
> You should google on "design patterns" and make your choice.

A misuse of inheritance eh? Inheritance, like other language features,
is merely a tool. I happen to be using this tool to have my virtual
persons change roles at different points in their lifetime, as many
real people tend to do. Thus, at these points, B is indeed an A. What a
person is, whether in real life or in my program, is not static and
comes into definition uniquely for each moment (micro-moment, etc.) of
existence. Now, please, I have no intention of carrying the
conversation in such a silly direction, I wasn't inviting a discussion
on philosophy or some such. I seek to work the tools to my needs, not
the other way around.

> --
> _____________
> Maric Michaud
> _____________
> Aristote -
> 3 place des tapis
> 69004 Lyon
> Tel: +33 426 880 097

More information about the Python-list mailing list