[Tutor] howto keep a program organised?
Rob Vogel
robvog at gmail.com
Mon Sep 11 11:24:26 CEST 2006
Hello All,
I have been programming with Python for a few weeks now. By now I have
problems keeping my program organised.
(program runs from a Linux Busybox environment).
For example, I may need to mount the usb storage device at some point
in the program.
For this end I made the following functions:
- usbMount() -> main function.
- usbUmount() -> main function.
- usbMounted() -> help function. Checks if usb already mounted.
- usbConnected() -> help function. Checks id usb connected to computer.
- usbValid() -> help function. Checks if usb contains certain info
(only these may be mounted).
The help functions are called from the main functions.
So I have multiple help functions, while only two are actively called.
What is a good way to keep this organised?
- Just put it in a usb.py module?
- Should I make a class?
I haven't worked with OOP before, because I didn't think it would be
useful so far.
Are there any advantages if I put this in a class, instead of in a module?
This is only a small example, but I run into the same problem with
other parts of my program, that are larger, and where the functions
also depend on each other, while only a few are called (and the rest
just clutter my view in the IDE).
Any advice about how you organise this kind of things, is very much appreciated.
Thanks,
Rob
More information about the Tutor
mailing list