Does Python really follow its philosophy of "Readability counts"?

James Mills prologic at shortcircuit.net.au
Wed Jan 14 06:57:42 CET 2009


On Wed, Jan 14, 2009 at 3:11 PM, Russ P. <Russ.Paielli at gmail.com> wrote:
> I think you are the one who is confused. Part of the problem here is
> that the term "encapsulation" has at least two widely used meanings
> (in the context of programming). In one sense, it just means grouping
> data and methods together. In another sense, it means restricting the
> client's access to data or methods. Someone earlier on this thread
> tried to claim that the first meaning applies to OOP, but Wikipedia
> (and many other sources) say just the opposite.
>
> People here are trying to claim that the leading underscore
> conventions used with Python are essentially equivalent to
> encapsulation. That is nonsense, of course.
>
> Others are arguing against encapsulation altogether. That is a bit
> like being against locks or passwords because they create a lot of
> hassle. Now locks are not needed everywhere, of course, but certainly
> they have their place. But the point is that if you don't like
> encapsulation, then by definition you don't like OOP. You may like
> certain features of OOP, but you don't like it in general. That's
> about all their is to it.
>
> And by the way, please don't bring up the canard that I am some kind
> of OO zealot. I think OO is overrated, and I don't Java, in part
> because it forces everything to be OO. The issue here is not my
> personal opinion of OOP. This issue is one of widely accepted
> definitions within the OO community.

Russ:

1. Quit while you're ahead.
2. OOP is encapsulating data and functionality into a single grouping (object).
3. Other features more recently developed by OO languages such as
Polymorphism, Access Control (a type of encapsulation), Inheritance
and Multiple Inheritance are all irrelevant and OO languages either
implement all or a subset of these features and each do so
differently.

Fundamentally it all boils down to4 things (which all of you -
including you Russ - just completely miss the point):

READ
UPDATE
ADVANCE

These are the 3 operations of a Turing machine of which all
computer algorithms can be defined. We usually define a 4th operation
called HALT.

Now go ponder on that a while and come back and tell
me whether you think you really need such things as
Abstract Base Classes, Interfaces, Access Control,
Static Typing, and so on and so forth ...

>> Give me one use-case where you strictly require
>> that members of an object be private and their
>> access enforced as such ?
>
> You're kidding, right? Think about a ten-million line program being
> developed by 100 developers.

And what is your point exactly ? Like I said, this is _not_ a valid
use case. A language that implements all of the features descirbed
in academic texts on OOP will not help you build such a system
any faster.

I should also point out that building such a system in Python would
most likely result in 1/3 of the size in terms of LoC.

I should also point out that your numbers you pulled out of your
hat would require 22years of development time given the industry
standard of 5 LOC/hg per developer. Good luck with that.

cheers
James



More information about the Python-list mailing list