karl.fast at pobox.com
Thu Nov 6 10:53:32 EST 2003
> I am coding in a procedural way, and then going back over the code
> and recoding parts into an OO model. Is this a normal...
I found something similar, at first. I was never formally taught OO,
and my programming experience was mainly fortran, pascal, perl, IDL,
and assembler....the whole OO thing was a mind twister. But
increasingly it feels more natural, and python made the transition
Several factors helped me make the jump: a big-ish project, a GUI
interface using wxPython, and several weeks of uninterrupted time to
work on it. The GUI bit was both the most frustrating and the most
helpful (wxPython is big, but is easier if you think OOP).
The project was (is!) a custom web spider. I'd used perl for similar
programs and my conception of the problem was a long-running batch
job. I thought about it in a procedural way (instantiating objects
from perl modules, but never creating my own classes).
I started doing things procedurally, but the GUI bit slowly helped
me understand the OO paradigm and forced me to begin making my own
classes. I rewrote my procedural code into some classes, making it
much easier to fit it into the wxPython framework.
I still think procedurally, but I no longer hesitate to create my
own classes. Lots left to learn, but in three weeks I've come a long
ways. I couldn't have come this far in C++ or Java.
Yesterday I was asked to quickly whip up a small robot for a related
project. I immediately subclassed some classes I made for the other
project, imported a few more, and in a few hours the basic shell was
all done. Up with OO and code reuse!
More information about the Tutor