[newbie] Looking for a good introduction to object oriented programming with Python

lipska the kat lipskathekat at yahoo.co.uk
Sun Aug 5 15:46:23 EDT 2012


On 04/08/12 16:49, Jean Dubois wrote:
> I'm looking for a good introduction to object oriented programming
> with Python.

<rant>
Object Oriented programming is a mindset, a way of looking at that
particular part of our world that you are trying to encapsulate
in computer language. The language you use is (should be) irrelevant.

The ONLY concept that you should never try to encapsulate is/are human
beings or their aliases. So Person, User, Human etc should not exist in 
any way shape or form in your design. There is an argument that User is
ok but I don't subscribe to that.

If you want to represent human interaction in your software design use
Account or Session or some other non human noun.
</rant>

Actually it should really be called Class Oriented programming as
classes are the units of encapsulation.
I really don't think python is a good language to learn OO programming,
the problem is that Python doesn't enforce OO so you are never going to
learn what is 'OO' and what isn't.

Before I get told off/flamed/shouted at I've just started learning
Python and I think it is a great language with a fantastic standard 
library. I've already managed to write meaningful code but I haven't 
invented a single class yet.

Apologies if this sound negative, it's not meant to be it's meant to be
constructive.

There is a book you could try, it's a bit dry and I read it when I can't
sleep, about 30 mins usually does it :-)
It's called Design Patterns by Gamma, Helm, Johnson and Vlissides
ISBN 0-201-63361-2.
They do use C++ code in examples but as they say, this is just a
convenience and shouldn't colour your view of the subject
I still read the introduction and get something out of it after several
years. You should be able to implement the patterns in Python
although I must admit I haven't tried that yet

Learn Python by all means, the interactive mode is particularly fun,just 
try and get a good idea of what OO is all about before you start.

Just my opinion

lipska



-- 
Lipska the Kat: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun



More information about the Python-list mailing list