|
> From: Hans Boldt > > 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". Hans, this just isn't correct. Without objects, you don't have data members, so the issue of setters and getters just doesn't come up. The closest you can come is static procedure variables, which are really quite different since a single process can't have two "objects" with different values in the static procedure variable. Having private data members, on the other hand, is absolutely an OO concept, dating back as far as Simula, the first OO language, and Smalltalk, the most OO language of all. C++, Java and Eiffel Ada all support them. Smalltalk doesn't necessarily even have private methods or classes, but it still has private variables. And it's not an issue of compiled vs. interpreted languages; even JavaScript and Perl support private variables (though Perl requires a little more work). The primary motivation of creating abstract data types (or classes) is that global variables are a bad thing. Thus, every OO language has the concept of a private variable. Not "certain" languages. Every OO language besides Python. The fact that Python doesn't support private variables doesn't make them non-OO, it makes Python different. Joe
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.