Mixins Considered Harmful

Ovid on 2009-04-17T14:34:09

I know many folks are tired of the "X Considered Harmful" writeups, (I should do a "Considered Harmful Considered Harmful" writeup?), but there's an interesting one by Michele Simionato, a moderately well-known Python programmer. He's written a multi-part series on this.

Interestingly, one proposed solution he's put forward is implementing traits (roles) in Python. He argues that while mixins seem fine for smaller systems, they start to become unwieldy in larger systems. That was one of the driving issues which led to the Refactoring with Roles talk I gave.

My only disappointment is that he seems focused on primarily on eliminating multiple inheritance rather than inheritance in general, but then, I think I've displayed my bias here.


Role organization

grink on 2009-04-17T18:45:53

How do you store roles in a project (where do they go in your namespace)?

Do you have a special package, like:

MyFramework::Role::Does*

Re:Role organization

Ovid on 2009-04-17T19:50:13

Yes, that's exactly where I put them. However, if you prefix everything with Does..., the Role portion of the namespace is almost redundant. Maybe MyFramwork::Does::...?

Re:Role organization

grink on 2009-04-17T20:38:23

I like Does::

(insert picture of a Pakled)

http://img522.imageshack.us/img522/9214/pakled1.jpg

Considered Harmful Essays Considered Harmful

oneiron on 2009-04-18T00:19:58

I should do a "Considered Harmful Considered Harmful" writeup?

"Considered Harmful" Essays Considered Harmful