OO re-factoring (was Pythonese/Efficiency/Generalese critique [onTutor])

L

Lee Cullens

In my original post I noted my recent exposure to Python and put up a
little utility to my iDisk asking for a Pythonese/Efficiency/
Generalese critique.

Javier, Kent and Liam were gracious enough to offer comments, which
were greatly appreciated. To follow through with the learning
exercise, I incorporated their comments (at least the ones there were
no conflicting opinions on :~) and put up the new version as:
http://homepage.mac.com/lee_cullens/DirTreeToCSV.zip

I was thinking of extending the learning exercise by re-factoring it
as an OO approach, since it would contain a minimum altered method.
Being new to OOP also though, I'm confusing myself with how that
would be best accomplished. My thinking is that class/subclass
method instances would replace the recursive functions approach, but
have as yet not formed the coding in my mind.

I've read a lot on OOP, but seem to have a problem with the practical
use of such in this utility. I'm undoubtedly creating a mountain of
an ant hill in my mind, so any thoughts would be appreciated.

Thanks,
Lee C
 
D

Dan Sommers

... My thinking is that class/subclass method instances would replace
the recursive functions approach, but have as yet not formed the
coding in my mind.

I don't remember the original post, but methods and recursion are *not*
mutually exclusive (e.g., an Integer class with a factorial method, or a
binary tree class whose nodes are also binary trees).

Regards,
Dan
 
G

Greg Ewing

Dan said:
I don't remember the original post, but methods and recursion are *not*
mutually exclusive (e.g., an Integer class with a factorial method, or a
binary tree class whose nodes are also binary trees).

Also, don't think that you have to make everything OO.
OO isn't necessarily better than non-OO. It's a means
to an end, not an end in itself.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top