Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
No reason to make it harder on people that way - reason is simple: people who violate encapsulation should be beaten with sticks anyway.

Nah, I'm just kidding. But anyone who is bypassing your api to access values themselves (perhaps just because you accessor methods do extra stuff?) should know that they "void warranty if opened" as it usually says on most electronic boxes you can buy. They are on their own. And if that turns out to be a bad thing, well, you did tell them, yes? By having accessor/mutator methods, you specifically declare that this is the way the data should be accessed.

Even heavily guarded languages like java provide the same capability to directly access just about anything inside a class - if you choose to. In java, it is called reflection, and as mentioned above, it is possible in just about any language, really. If you want to.

I don't recall exactlty how, but I think that the Camel book had some nifty examples on how you actually could create truly private data, with no possibility (apart from patching) to access the properties or data at all. Take a look at the Object chapter (I think) of that book if it is important with private data.

Life tends to be so much simpler if one just follows the guidelines that are set up. But if you need to break the rules for one reason or the other, it should be easy to find the data you want to manipulate - which might be a reason not to name the property too differently. So that people that wishes to do so, can more easily follow tthe code and extract what they want... with warranty void, of course. :)

You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

In reply to Re: A new take on affordance. by Dog and Pony
in thread A new take on affordance. by frankus

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [Corion]: Your Mother: Aah - Server Side Events maybe, which mostly sends events from the server as they come up?
    [Your Mother]: Sounds right.
    [Corion]: Your Mother: I think that that is basically the origin story. Flat earth started as trolling, but then the real believers drove out the trolls
    LanX is pretty brown in summer
    [Your Mother]: Though a bad match for the OP in question here. :P
    [Corion]: Your Mother: Yeah
    [Your Mother]: Americans are still pumping out video games where you get to slaughter as many Germans as you have the GPU for... It has always struck me as odd that this particular case seems fine to people. :\
    [LanX]: yep heard the same origin story
    [Your Mother]: I like it. I tottered on going into hucksterism because I feel like the world deserves it.
    [LanX]: he ... we have a movement here called Anti-Germans based on this

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (18)
    As of 2018-03-19 13:39 GMT
    Find Nodes?
      Voting Booth?
      When I think of a mole I think of:

      Results (240 votes). Check out past polls.