|
Joe, help illuminate please. Windmill tilting is for lesser men. "Hans. Information hiding is an OO concept. Period." so, hiding information is both unique to and a requirement of OO? --------------------------------------------------------- Booth Martin http://www.MartinVT.com Booth@xxxxxxxxxxxx --------------------------------------------------------- -------Original Message------- From: RPG programming on the AS400 / iSeries Date: Thursday, May 08, 2003 10:55:42 To: RPG programming on the AS400 / iSeries Subject: RE: back to: improving rpg. was: what is object oriented programming > From: Hans Boldt > > But Joe, the fact that a language supports objects does not make it > an "object-oriented" language. (Just like the fact that OS/400 has > "objects" doesn't make it "object-oriented".) In any old procedural > language, you can support a framework where "objects" are created > and referred to using pointers and where the hidden attributes of > the objects are "get" and "set" using procedures. Hans. Information hiding is an OO concept. Period. First, the attempt to prove that Python supports information hiding: > Regarding Python, it does indeed support private attributes. Names > beginning with two underscores are considered "private" to the class > and aren't made public when a class is imported. Furthermore, > attributes (rather than functions) can be handled as read-only or > write-only by appropriate coding of the "__getattr__" and > "__setattr__" methods. (This latter feature makes "get" and "set" > methods somewhat unnecessary.) All that happens with double underscores is that Python mangles the variable name by including the class name as a prefix. Mangled variables are only used to prevent collisions - they can still be accessed by clever programming. __getattr__ is only called when the attribute cannot be found in the object's local dictionary, so it is not a strict replacement. And even if it were, this is a very kludgy alternative to having a private variable. For every private variable, you have to create some dummy method that does .... what? I dunno, throw an exception at runtime? This is hardly a reasonable thing to ask of a programmer. Final analysis: no, Python does NOT support private variables. It has smoe very nasty workarounds, but no private variables. And just in case that fails, the technique of redefining terms. From a previous post: > "For example, defining "get" and "set" methods to access particular > pieces of data within an "object" isn't really a part of OO. While > it's a technique commonly used in certain OO languages, > "encapsulation" is more an aspect of "modular programming". This post: > In conclusion, the ability to implement data hiding in some form or > other may well be a characteristic of good OO programming (no > argument there). But the strict enforcing of data hiding by the > language processor is not necessarily a requirement of an OO > language, nor is the principle of data hiding exclusive to OO. What exactly do all these words mean? Is information hiding an OO concept or not? You're seeming to say that a language can be an OO language even if it doesn't explicitly support good OO programming - that while information hiding is a good OO technique, OO languages needn't explicitly support it. This is an incredibly Zen way of looking at things. Because as you well know Hans, you can program inheritance without an explicit language construct. In fact, as Leif has pointed out, any language with certain core concepts (basically compate and branch) can emulate any other. Therefore, I can write a program in RPG that emulates every single aspect of OO programming. And thus, by your definition, RPG is an OO language. Or are there certain features which Hans Boldt has decreed are required for a language to be OO, while others are not? Is so, my guess is that such a list would probably very closely match the Python feature list. However, if private variables is one that is not required for the Hans Boldt definition of OO, then that definition is starkly different from - well, from nearly everybody else on the planet. For any text on OO that doesn't mention "information hiding", I will find ten that do. To repeat: Information hiding is an OO concept. Period. Anyway, this has once again devolved to watching you avoid saying "I'm wrong". I'm tired and need to do productive things. Joe _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo.cgi/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. .
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.