Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: I don't think inheritance is essential

by chromatic (Archbishop)
on Sep 01, 2005 at 17:18 UTC ( [id://488432]=note: print w/replies, xml ) Need Help??


in reply to Re: I don't think inheritance is essential
in thread Advanced Perl Programming, 2nd edition

Personally, I can't think of a good reason not to use inheritance.

I can. It encourages code reuse along the wrong lines, caring more about position in an arbitrary (and quite possibly wrong hierarchy) than about the capabilities of the class.

That's why Perl 6 encourages the use of roles.

  • Comment on Re^2: I don't think inheritance is essential

Replies are listed 'Best First'.
Re^3: I don't think inheritance is essential
by sri (Vicar) on Sep 02, 2005 at 00:05 UTC
    Yes, multiple inheritance is quite lame for mixin style programming, but try to think a bit more abstract.
    The important part is that we use it in combination with NEXT for AOP like programming, think AspectJ without static trigger points!
    package Foo; use base qw/Bar::Unicode Bar/; __PACKAGE__->prepare_parameters; package Bar; sub prepare_parameters { my $class = shift; # initialize parameters... } package Bar::Unicode; use NEXT; sub prepare_parameters { my $class = shift; # let parent initialize parameters $class->NEXT::prepare_parameters; # utf8 encode parameters... }
    Hope this makes it a bit clearer.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-18 18:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found