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 ]

chromatic (983)

chromatic
  (email not shown publicly)
http://wgz.org/chromatic/

Blog Information [technorati.com] Profile for chr0matic [technorati.com]

Journal of chromatic (983)

Friday June 08, 2007
01:24 AM

Traits? Roles? Yeah!

[ #33467 ]

Daniel Berger isn't keen on the future of traits.

Okay, so I'm the Perl 6 designer most excited by them (and the one most to blame for them, though that's only by plurality of blame and not majority), but I've used them and they've solved real problems in my code with regard to duplication, typing, and genericity.

I suspect the users of Class::Trait have similar stories.

Don't get me wrong; I'm not down on duck typing in general. I think static, inheritance-heavy hierarchies tend to lead to bad designs. Yet there is a very real false cognate problem with duck typing and there are better ways to bundle and re-use code with cross-cutting concerns than mixins and monkeypatching.

I suspect though that languages which make doing the wrong thing both easy and syntactically attractive (yes, Smalltalk and Ruby) lead to subtler forms of technical debt in the form of near-duplication and potential fragility.

(Of course, if you always think of objects and classes in terms of objects and classes and not verbs bundled under appropriate adjectives, you make different design decisions. Hm, I almost made it through this entry without using the word "allomorphism".)

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.
  • Daniel makes this comment in relation to someone on a Smalltalk mailing list mentioning that they didn't know of anyone using traits in production. Admittedly, this was Avi Bryant, the developer of Seaside, but still, let's think about it. The Smalltalk community is a much smaller community than Perl. In the Perl community, we have some relatively well-known people evangelizing traits -- yourself, Stevan Little (to an extent) and myself, to name a few -- and we have routinely written blog entries, articl

  • Someone in the Python community gets it as well:

    http://code.enthought.com/traits/ [enthought.com]
    • I have looked over this one a couple of times, and I am still not sure it is really related to the Smalltalk Traits which chromatic is talking about. There might be some similarities, but beyond that I am not sure.

      - Stevan
      • Funny; I almost posted the same thing. It looks similar in a familiar way, but I don't understand it well enough to say "Yep, that's it!"

        • On first pass it looks like they are using it for "glorified" assertions. I would have to look deeper to know.
  • I suspect the users of Class::Trait have similar stories.

    There has been a recent boost in role usage in the Moose community, so I suspect we will have some stories as well. I have submitted a roles talk to YAPC::EU, which takes a "how roles can solve problems in the real world" approach and I think provides a pretty compelling use case (based on actual experince using roles in a production system).

    - Stevan