Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

This seems to be a highly contested issue with Perl OO programmers. Most feel that private methods should remain private and only the public interface should be exposed (which I now tend to agree with). Others seem to feel that you can override anything you want. If you need to get something done, sometimes the best way is to break the rules.

Java has class data which can be declared "protected", which means that classes in the same package can access it, but it's private data as far as anyone else is concerned. Protected methods can be overridden. I would say that the subclassible _init() would fall under the catagory of a protected method.

As is always the case with Perl OO, there are no formal specifications for implementing protected data. Being that Java is the most OO-purist language in common use1, copying it's idioms for OO isn't such a bad thing. It's not like Perl hasn't copied things from everyone else.

1 Yes, I realize that Java isn't a pure OO language, due to primitives like 'int'. The key phrase here is in common use. My personal theory about this is that truely pure OO langagues are so annoying that no one would want to build a real application with them. (And this is where a bunch of replies come in that tell me how wrong I am and pure OO langs are used all the time :)

----
Reinvent a rounder wheel.

Note: All code is untested, unless otherwise stated


In reply to Re: Re: Private methods by hardburn
in thread Private methods by crouchingpenguin

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 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? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2021-09-28 17:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?