python without OO
Neil Benn
benn at cenix-bioscience.com
Wed Jan 26 06:01:47 EST 2005
Davor wrote:
>Is it possible to write purely procedural code in Python, or the OO
>constructs in both language and supporting libraries have got so
>embedded that it's impossible to avoid them? Also, is anyone aware of
>any scripting language that could be considered as "Python minus OO
>stuff"? (As you can see I'm completely new to Python and initially
>believed it's a nice&simple scripting language before seeing all this
>OO stuff that was added in over time)
>Thanks,
>Davor
>
>
>
Hello,
Yes you can, that is a benefit and flaw of python in that you
can mix up procedural and OO code, it allows for simple solutions -
however it also allows for you to create all kinds of havoc. IMHO,
there would have to be a very very small task to require procedural
code. Especially if the code is gonna be open sourced (and presumably
built upon) you will benefit from a proper design so that it can be
developed and moved on in the future.
One other thing, if your developers are proposing deep inheritance
trees in _any_ language then they are designing incorrectly. In none of
the languages I code in would I design a deep inheritance tree, the deep
inheritance tree is a fault of the designer not the language (for
example Java does not force you to design deep inheritance trees!) - 90%
of the time. I say this because you do need to be aware of the
'mythical python wand' which will turn you from a bad programmer into a
good programmer simply by typing 'class Klass(object):'.
Rather than reading a GOF book, I'd pick up an introduction to OO
programming book to take a refresher course - you thank yourself!!
Language without OO at all - what about Logo - drive that little
tortoise around!!
Cheers,
Neil
More information about the Python-list
mailing list