Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^4: OO design: abstract class or can()?

by adrianh (Chancellor)
on Mar 24, 2007 at 20:52 UTC ( #606432=note: print w/replies, xml ) Need Help??

in reply to Re^3: OO design: abstract class or can()?
in thread OO design: abstract class or can()?

It's also a nice bit of future-proofing in case Perl ever gets multi-dispatch... and that day may be closer than many people think. (I mean dispatch based on role, not structural type.)

Meh. Still think it would be simpler without the "if". Spinning out the calling behaviour from the thing being called feels odd to me.

If the calling is independent of the class then something AOPish would seem appropriate. If not then having e the base class have that trait with a null method rather than have a condition on something that may not be present seems cleaner to me.

  • Comment on Re^4: OO design: abstract class or can()?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://606432]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2016-10-25 10:15 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (315 votes). Check out past polls.