Python Productivity over C++ (Encapsulation)
Hung Jung Lu
hungjunglu at hotmail.com
Thu Jun 15 19:57:02 EDT 2000
--- In python-list at egroups.com, m.faassen at v... (Martijn Faassen) wrote:
>Encapsulation is necessary if you want abstraction.
Hmm... I guess we are talking about different encapsulations. I was talking
about the "private" keyword alone (hence data hiding.) Sorry if I have not
been more clear. Instead of "encapsulation" I should have said "data hiding"
or simply the "private" keyword.
I agree that data members are best accessed through accessor methods, and
that's the way I (and most people) program. But I really can't live with the
"private" keyword. If I have been criticizing "encapsulation", it's because
I was referring to the "private" keyword, not the accessor methods.
There is no need for the "private" keyword, if a program works through
accessor methods. If one doesn't want a particular accessor method to be
used by others, one can simply use a naming convention (like an initial
underscore _).
>That doesn't mean a Python programmer should forget about encapsulation.
Not encapsulation... "abstraction" would be a more correct word, I guess.
Encapsulation conveys the image of data hiding and data ownership.
regards,
Hung Jung
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
More information about the Python-list
mailing list