Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I don't like perlboot, since it makes the all-too-common mistake for OO introductions of stressing inheritance to the point of making it seem like the whole point of OO is inheritance.

I do lots of OO programming and I don't use much inheritance. And when I do use inheritance, it is almost always interface inheritance using a purely virtual class that simply defines an interface and includes no implementation.

Unfortunately, Perl OO doesn't really support interfaces (unless you consider a simple list of method names to be an interface) so this type of inheritance is pretty pointless in Perl.

So I find inheritance to usually be the wrong answer in Perl. And yet I find lots of people who decide to "go the OO route" in Perl and immediately start thinking "what should inherit from what here?"

The point of OO, especially in Perl, is to nicely wrap all of your related data up into a convenient package that also knows the things that you can do with that data.

I find that if I'm writing a module, then it is best to just write it using OO, no matter how small it starts out to be. Without even thinking about it, you'll likely end up with a module that is much more robust in the face of being used from multiple parts of the same program and yet has a much lower risk of namespace collisions.

        - tye

In reply to (tye)Re: Make Perl an OO language by tye
in thread Make Perl an OO language by gildir

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-03-29 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found