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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I've always been big on the "shotgun quote" not because of the idea that enforcement in not neccessary, but that writing accessors and mutators ad nauseum is silly

... i.e, by convention a blessed hash with internal data should only be accessed externally by class methods, and if the functions don't exist, it's at-your-own-risk. Internal hash-access, thereby being unacceptable/against-convention/etc ...

Bottom line -- everything is private if you agree to stay out of the living room, and that's a great design point. Once you start saying "I have a shotgun, but you can come in if", you start walking down the road of non-OO-OO, aka java-esque accessor/mutator hell.

I suspect there are a lot of yet undiscovered uses for this technique that will only be revealed with time and community acceptance. If nothing else, it will shutup the Java people claiming that Perl OO has poor encapsulation.

As much as I hate Java, I won't defend a failing in Perl when I see it. Perl does have horrible encapsulation, primiarly because of what you had to write to achieve it. Perhaps if stuff like this was in the core module distribution, a la "use ObjectVoodoo" or somesuch, we could argue the language did it well, but as it stands, the language does it poorly, and it becomes the role of the coder to fix the language ... hence (at least) Java speaks it more fluently. Usually java coders get it all wrong though -- and by no means is java a shining example of OO.


In reply to Re: May Thy Closures Be Blessed by flyingmoose
in thread May Thy Closures Be Blessed by hardburn

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 avoiding work at the Monastery: (3)
As of 2024-03-29 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found