Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Tuesday July 14, 2009
05:08 PM

Look Familiar?

[ #39291 ]

Bernie Sumption, the author of Animator.js, has an interesting article explaining why inheritance is evil. What's really interesting about his code is that in trying to eliminate is-a relationships and replacing them with more flexible has-a relationships, he has to create a bit of extra scaffolding to make everything work. The problem is that the scaffolding is delegation and if the instance and the thing it delegates to need to communicate, you wind up with more work to do. Plus, he still has to use inheritance to make things work, thereby inviting (at a much smaller scale) some other problems with inheritance (did you implement a from() method in your DBIx::Class::ResultSource subclass? Too bad. You just overrode a method you didn't know about).

The solution, of course, would be to use roles for this. It would be cleaner and would make much of the scaffolding just go away. Plus, you get compositional safety. That being said, he may not be aware of roles, so it's not something I would call a black mark on an otherwise good blog post.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.