Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: May Thy Closures Be Blessed

by adrianh (Chancellor)
on Apr 26, 2004 at 15:43 UTC ( #348219=note: print w/replies, xml ) Need Help??


in reply to Re: Re: May Thy Closures Be Blessed
in thread May Thy Closures Be Blessed

I know it's possible to dig into someone else's lexical scope, but it's far more difficult than doing $obj->{foo}. Ultimately, I can't do anything to stop someone from tralling through /dev/mem or the equivilent on another system.

You don't have to go as far as that in this particular instance. All you need do is fake being in the appropriate package, which isn't hard ;-)

As you point out, this isn't really the issue - the issue is accidental interference rather than deliberate trespass.

Replies are listed 'Best First'.
Re: Re^3: May Thy Closures Be Blessed
by flyingmoose (Priest) on Apr 26, 2004 at 16:37 UTC
    As you point out, this isn't really the issue - the issue is accidental interference rather than deliberate trespass.
    Deliberate trespass in your own codebase isn't something you fix in software, it's something you fix by going over to someone's cube and removing their mouse balls until they get the point. Anyhow, if you can't trust your fellow coders to not play symbol table / reflection / etc type games, you have problems! So folks think they have encapsulation, but they don't, and they think they have loose coupling, but they don't.

    Encapsulation is mainly in existance to enforce clean boundaries between objects, and ideally these boundaries should be limited to a very small list of methods and few variables, such that changes in the objects don't break programs.

    Furthermore, encapsulation can be broken with no access to variables, by virtue of having trivial getter/setter methods encapsulation IS broken, because the parameters of your object can be tweaked without asking the object nicely. Most folks already know this, but at least in the java world, many don't!

      Deliberate trespass in your own codebase isn't something you fix in software, it's something you fix by going over to someone's cube and removing their mouse balls until they get the point.
      I knew there was a reason I prefer optical mice.
      Anyhow, if you can't trust your fellow coders to not play symbol table / reflection / etc type games, you have problems!
      Well, preventing deliberate tresspassing can be an issue - if you run code of untrusted people. Don't think that never happens - it happens all the time. You don't want that processes can change their UIDs to anything they like, do you? ;-). Granted, Unix processes aren't very object like. Another example: MUDs runs code written by many untrusted contributors, sometimes hundreds or even thousands, who can subclass almost any object. A MUD would break down if there was no way to prevent deliberate tresspassing.
      Furthermore, encapsulation can be broken with no access to variables, by virtue of having trivial getter/setter methods encapsulation IS broken, because the parameters of your object can be tweaked without asking the object nicely.
      This I don't understand. How does that break encapsulation? The fact there are getter/setter methods means they are part of the API. Calling a setter method is asking the object nicely (and it's up to the object to refuse).

      Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://348219]
help
Chatterbox?
NodeReaper wonders through a maze of twisty little sayings, all alive

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2017-12-14 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (414 votes). Check out past polls.

    Notices?