Saturday, 10 August 2013

Reasoning behind Object Oriented Access Specifiers

Reasoning behind Object Oriented Access Specifiers

I have a general question regarding the reason for object oriented access
specifiers. I have never completely understood the reasoning why they
exist and just thought they were there as a very rudimentary form of
code-security but after looking at the discussion on this thread
Does python have 'private' variables in classes?
I have understood that I am completely wrong and they don't help with
security at all. So are access specifiers just considered good programming
practice in object oriented design? And when we say private or protected
who exactly is this protecting the data-field or class or method from?
Isn't it still possible for people to get access to the method already
know its there? Through reflection and other methods?
I apologize if this question seems basic or a bit meta-oop but its always
bothered me that I don't quite know the exact reasoning for one of the
main OOP concepts of Encapsulation.

No comments:

Post a Comment