main and dependent objects

alex23 wuwei23 at gmail.com
Thu Sep 13 22:05:16 EDT 2012


On Sep 13, 10:52 pm, andrea crotti <andrea.crott... at gmail.com> wrote:
> I am in a situation where I have a class Obj which contains many
> attributes, and also contains logically another object of class
> Dependent.
> But I'm not so sure it's a good idea, it's a bit smelly..

It's actually a well regarded technique known as composition:
http://en.wikipedia.org/wiki/Object_composition

While it has an ostensible focus on game development, I found this
article to be very good at explaining the concept:
http://gameprogrammingpatterns.com/component.html



More information about the Python-list mailing list