lies about OOP

Dave Benjamin ramen at lackingtalent.com
Thu Dec 16 02:20:18 EST 2004


In article <mailman.7828.1103172841.5135.python-list at python.org>, Adam DePrince wrote:
> On Tue, 2004-12-14 at 18:27, Roy Smith wrote:
>> Terry Reedy <tjreedy at udel.edu> wrote:
>> > I did not really 'get' OOP until after learning Python.  The
>> > relatively simple but powerful user class model made more sense to
>> > me than C++.  So introducing someone to Python, where OOP is a
>> > choice, not a mandate, is how *I* would introduce a procedural
>> > programmer to the subject.  YMMV.
>> 
>> OOP is a choice in C++ too.  You can write procedural C++ code; no
>> need to use classes at all if you don't want to.  Something like Java
>> is a different story.  Java *forces* you to use classes.  Nothing
>> exists in Java that's not part of some class.
> 
> Static methods act like C functions.  Sure, they are members of classes,
> but in name only.  Besides, just as you can use a procedural language in
> an OO fashion with enough programmer discipline, you can write in a
> procedural style with an OOP language with sufficient rebellion.  Just
> use one class, put everything in it and create one instance on startup.

Maybe I'm reading this wrong, but it seems like you're implying that
procedural code is inherently unmodular. Why would just one class/instance
suffice to represent a procedural program? I think of namespacing and code
organization as broad concepts that cut across all styles of programming.

Interestingly, Python's main unit of modularity is the "module", not the
"class". A direct translation of a typical Python module to Java would look
something like a Java class containing only static methods and inner classes.
Even this would be considered rebellious within the context of ordinary Java
programming.

-- 
 .:[ dave benjamin: ramen/[sp00] -:- spoomusic.com -:- ramenfest.com ]:.
        "talking about music is like dancing about architecture."



More information about the Python-list mailing list