Re: Why does python not have a mechanism for data hiding?



Russ P. a écrit :
On Jun 2, 6:41 am, Carl Banks <pavlovevide...@xxxxxxxxx> wrote:

You are not realizing that only useful(**) thing about data hiding is
that some code has access to the data, other code does not. If you
"hide" data equally from everyone it's just a useless spelling change.

I think you're missing the point.

As I see it, the primary value of data hiding is that it provides
useful information on which data and methods are intended for the
client and which are intended for internal use. It's like putting a
front panel on a TV set with the main controls intended for the
viewer.

People seem to be preoccupied with whether or not the back panel of
the TV is locked, but that is not the main issue. Sure, you probably
want to make the back panel removable, but you don't want the viewer
opening it up to change the channel, and you certainly don't want to
put all the internal adjustments for factory technicians together with
the controls for the end user.

As far as I am concerned, the current Python method of using
underscores to distinguish between internal and external methods and
data is an ugly hack that goes completely against the elegance of the
language in other areas.

As far as I'm concerned, it's JustFine(tm). I don't have to ask myself if an attribute is part of the API or not, I know it immediatly.

It is like a TV set with no back cover and
the volume and channel controls intermingled with the factory
controls. The underscores are just an afterthought like a red dot or
something used to tell the TV viewer what to fiddle with.

Your opinion. But beware of leaky TV-Set-metaphor abstractions

Python is a very nice language overall, but as far as I am concerned
the underscore convention is a blemish. I just wish people wouldn't
get so infatuated with the language that they cannot see the obvious
staring them in the face.

I definitively don't have problem with this naming convention, which I'd find useful ever with a language having enforced access restrictions. If that's the only - or worse - wart you find in Python, then it must surely be a pretty good language !-)
.



Relevant Pages

  • Re: Why does python not have a mechanism for data hiding?
    ... "hide" data equally from everyone it's just a useless spelling change. ... the controls for the end user. ... The underscores are just an afterthought like a red dot or ... Python is a very nice language overall, but as far as I am concerned ...
    (comp.lang.python)
  • Re: Definition of outdated...
    ... There are often a reference to a programming language to be 'outdated', ... Looking strictly at the wording, then Java is more outdated than Delphi, ... What imo should be outdated is how money controls hype that controls ...
    (borland.public.delphi.non-technical)
  • Re: Anyone here tried KBasic?
    ... Thanks for that Rick. ... I think a major advantage that can secure long term confidence in a new language is the critical mass of users forming communities with source code samples, tuts, etc. VB had, and still has, far and away the biggest user support base of any language. ... there are more data types, there are more native controls, those controls have more properties, methods and events, there is an extensive set of built-in classes in RB offering functionality not available in VB. ... for example, the Me object refers to the active control, not the active form, For Each loops iterate through one-dimensional arrays only. ...
    (microsoft.public.vb.general.discussion)
  • Re: internationalize a dialog based application
    ... What I would do, to simplify my life, is create a set of "alternate" dialogs that are ... DLL or make the language decision on the fly so the next time the dialog pops up it gets ... So I'm going to assume that all controls are potentially resizable. ...
    (microsoft.public.vc.mfc)
  • Re: C# for a serious desktop app? (newbie question)...
    ... > right choices before I begin down a major project. ... > particular language for any problem...but I wizened up a bit and I am now ... messed about with the controls, ... Windows API. ...
    (microsoft.public.dotnet.languages.csharp)

Loading