What is meant by “protection” in real OOP?
I read up on the history of Smalltalk and Object Oriented Programming, and one thing I have not quite grasped is the idea of "protection."
I know you can protect methods from being accessed by making them private or protected in certain programming languages but something else must be meant here.
Do you protect objects from being changed? Do you protect them from being "talked to" / responding with valuable returns to unauthorized requests / initial-message-senders? To what purpose?
And how exactly are they being protected, by what mechanism so to speak? (particularly in Smalltalk)
9 comments
[ 2.8 ms ] story [ 51.1 ms ] threadThe objects store the state in instance variables. You cannot access the instance variables of objects from outside of the object. All instance variables are "protected" in the terminology of C++.
Thereby any further protection is totally up to the programmer right?
If objects can only change their own data, then all change affecting the object is either caused by the object itself, or indirectly by another when information crosses the interface the boundary presents (e.g. a message was received).
Most languages use a memory model that doesn't even have the concept of access rights, everything can potentially affect anything else. If your program has to be secure, this is a nightmare.
[0] https://en.wikipedia.org/wiki/Encapsulation_(computer_progra...
Also interesting:
https://en.wikipedia.org/wiki/Message_passing
https://en.wikipedia.org/wiki/Capability-based_security
https://en.wikipedia.org/wiki/Agent-based_model
https://en.wikipedia.org/wiki/Actor_model
The following might be intuitive https://raw.githubusercontent.com/erights/uploaded-papers/ma...