Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Welcome to the Monastery
 
PerlMonks  

Re: Informal Poll: why aren't you using traits?

by tilly (Archbishop)
on Nov 19, 2005 at 02:23 UTC ( [id://510052]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Informal Poll: why aren't you using traits?

I work with simple enough class hierarchies that traits would not be worthwhile.

That said, if you want to get others to use them, it would probably be most useful to clarify what kinds of problems traits are meant to solve, and how you can discover where they make sense in your code.

  • Comment on Re: Informal Poll: why aren't you using traits?

Replies are listed 'Best First'.
Re^2: Informal Poll: why aren't you using traits?
by Ovid (Cardinal) on Nov 20, 2005 at 15:48 UTC

    Problems they solve/when to use them:

    • Whenever you've duplicated behavior across unrelated classes.
    • Any time you might think about MI and it's only for code reuse (in other words, the subclass is not a more specific type of a super class)
    • Any time you might want a Java-style interface but you also want an implementation to go with that.
    • Any time you might want to use mixins (have you ever considered exporting methods?)

    Cheers,
    Ovid

    New address of my CGI Course.

      As I said, I don't need them. But you may want to look at Class::Trait's documentation with an eye to making those points early. In particular I think that it is more important to be fast to explain what traits can do for you than to say what they are.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://510052]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.