Newbie with some doubts.

Peter Maas peter.maas at somewhere.com
Thu Jan 12 16:52:53 EST 2006


Claudio Grondi schrieb:
>> Im newbie to Python (I found it three weeks ago) , in fact Im newbie to
>> programming. I'm being reading and training with the language, but I
>> still wondering about what Classes are used to. Could you please give
>> me some examples??
[...]
> I don't know any really good examples which were able to demonstrate 
> what Classes are good for and I am in programming already for decades.

Then you have in all those decades for sure never seen a GUI program
done with the Win32 API (not OO, ugly, hard to grasp) and a Delphi
equivalent (OO, elegant, easy).

> There is actually no real need for usage of Classes. 

This is your opinion, not a fact as your wording suggests. If the OP
is asking for examples it doesn't make sense to answer "Hey, I don't
know any examples".

 > The notion, that they could be useful comes eventually with longer
 > programming experience and/or with growing size of the code library.

I don't think so. OO is modeled after human reasoning. Look e.g.
at phrases like Bob calls a friend, Bob learns math.

What is better:

Bob.call(friend) or human_call(Bob, friend), Bob.learn(math) or
human_learn(Bob, math)?

On the other hand there are cases where the emphasis is on the
verb, e.g. compute the sine of alpha: sin(alpha) is perfect,
no need to code alpha.sin(). Therefore I like hybrid languages
like python giving the programmer the freedom to choose an
appropriate model.

 > If you can avoid to learn  about them, at least at the beginning,
 > take the chance - it will save you much trouble and help to get
 > things done.

Excuse me, but to present your personal experience as a law of
nature is not very helpful for a newbie seeking for advice not
for propaganda. It is plain wrong to claim that procedural
programming is kind of natural and OOP is rocket science.

> I for myself try to avoid classes where I can, especially
 > inheritance, because I consider the latter in most cases evil.

There are terrible OO libraries out there but this is not
a genuine feature of OOP. Bad code can be written in lots
of ways.

 > There are sure many others who can't imagin to program
 > without classes, so don't conclude that there is a
 > contradiction here - it's just the question of taste

It's not a question of taste it's a question of the kind
of problem to solve.

Peter Maas, Aachen



More information about the Python-list mailing list