Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: I don't think inheritance is essential

by robot_tourist (Hermit)
on Sep 01, 2005 at 10:48 UTC ( [id://488393]=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 I don't think inheritance is essential
in thread Advanced Perl Programming, 2nd edition

IMO your point number two is pretty fundamental to object orientation and is a very good one-line synopsis, you take a class and extend it by adding functionality, but keeping all the stuff you don't want to re-invent. And it gives you a nice tree to draw when you are designing your system.

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

How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
Robot Tourist, by Ten Benson

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

Replies are listed 'Best First'.
Re^2: I don't think inheritance is essential
by chromatic (Archbishop) on Sep 01, 2005 at 13:18 UTC
    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.

      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://488393]
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.