From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,78609accbfa860fe,start X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!h20g2000yqn.googlegroups.com!not-for-mail From: "Russ P." Newsgroups: comp.lang.ada Subject: usefulness of "data hiding" Date: Thu, 15 Jan 2009 16:51:38 -0800 (PST) Organization: http://groups.google.com Message-ID: <72f07ba4-f06d-44bf-9759-0e6f0d0426d0@h20g2000yqn.googlegroups.com> NNTP-Posting-Host: 128.102.146.45 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1232067099 1700 127.0.0.1 (16 Jan 2009 00:51:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 16 Jan 2009 00:51:39 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: h20g2000yqn.googlegroups.com; posting-host=128.102.146.45; posting-account=QXgf4wkAAADkKLOneY6DWJPpPelAjS0c User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20080325 Red Hat/1.5.0.12-0.14.el4 Firefox/1.5.0.12 pango-text,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:4335 Date: 2009-01-15T16:51:38-08:00 List-Id: Hello, I thought some of you here might be interested in the following debate I have been having on comp.lang.python with regard to the usefulness of "data hiding" or "enforced encapsulation." As many of you probably know, Python had no data hiding. It does not allow you to declare anything "private," and everything is public by default. (The convention is Python is to use a leading underscore to identify a private _object or _function.) I suggested that a "private" declaration could be useful if it could be implemented without changing the language too drastically. Now, I can understand that people just don't want to change the language that fundamentally, but many Python folks over there insist that data hiding is just plain useless in general. In fact, several people over there have argued that Python is perfectly appropriate for even the largest safety- critical systems. I've tried to explain to them why data hiding can be useful, but I just get back a lot of flak. If any of you are interested and have the time to educate them, I'd be interested in your replies to the following post, which was a reply to a post of mine. The link is http://groups.google.com/group/comp.lang.python/browse_frm/thread/068bc54bca830c46?scoring=d& Here is an excerpt: The first OO languages (at least the second one - Smalltalk) used data-hiding to clearly emphasize the "black box" nature of objects and the use of messages as the main (only in the case of Smalltalk) support for control flow. Remember than by that time, lost of programs where still mostly relying on *global* state changes. IOW, it has a strong educative value then... Following "OO" languages - mostly C++ and Java - kept this "rule" like it was a sacred cow (but mostly forgot about the more important points of 'everything is an object' and message-passing as main control flow). Then everyone started considering this as "fundamuntal", and here we are years later with one more cargo cult, when years of experience prove that it's not - at least from a practical POV. Once again, the important point is that there's a *clear* distinction between interface and implementation, and that you *shouldn't* mess with implementation. But what, some people think programmers are stupid, and so they hire stupid programmers, so they need b&d languages to protect stupid programmers from themselves - which just doesn't work, since *nothing* is idiot-proof. Heck, how many Java "OO" programs with dumb getter/setter pairs for _each and any_ attribute ? > As I said before, enforced encapsulation may not be appropriate for > every application, but it is definitely appropriate for some. No. It is appropriate for dummy managers hiring dummy programmers. The project's size and domain have nothing to do with it. > Not > every door needs a lock, but certainly some do. You only need locks when you don't trust your neighbours.