Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Re: Private methods

by hardburn (Abbot)
on Mar 10, 2003 at 15:25 UTC ( #241739=note: print w/replies, xml ) Need Help??

in reply to Re: Private methods
in thread Private methods

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2021-09-24 16:36 GMT
Find Nodes?
    Voting Booth?

    No recent polls found