[Tutor] In need for some advice

Alan Gauld alan.gauld at blueyonder.co.uk
Mon Aug 9 23:43:46 CEST 2004


> This is what i want to do:
> From our CAD system we get output files looking somewhat like file
> "output.txt" attached to this mail. ...
> I want to convert the file to look like "inputToPDM.txt" ...so
> i can import it to our PDM system

Sounds like a very good first project. Not too hard but enough
to test out your understanding and give opportunity for discovering
a few new tricks too.

> Then  ofcourse i want a little GUI which takes a input (a filename)
> and a output (a filename) :)

OK, 3 frames maybe. The top two each with a label and Entry widget
and the bottom with a couple of buttons?

> This is how i plan to do it:
> 1. Create a file named createEbomFromFile.py ...
> consist of a "class" "createEbomFromFile(self, inputFile,
ouputFile).

That looks more like a function. Remember objects should be things,
so named as nouns not verbs...

How about a PDMfile class with a method read(someFile)
where someFile is in the format you specified.

Or you could go the other way and have a Class for your input
file and give it a method producePDM(PDMfile)

Or maybe a combination of the two? How to choose?

Recall that ojects have responsibilities and are masters of their
own data. So think where the data lies and put the processing
methods there.

> 2. Create a file named createEbomFromFileGui.py which imports
> createEbomFromFile and creates my slick Tkinter interface.

Separation of data and presentation, well done. Thats always
a good idea.

> How does this sound? Am i being too complicated?

No, it's a good way forward.
Don't forget to play with the >>> prompt to try out your ideas
before committing them to a file. And remember there is never
an absolute right or wrong design.

> I want to design this program myself but i need some Startup tips.

Hopefully the above ideas are enough to set you going.
Something else you might like to try is to think about how you
will test the program. Again the >>> prompt will be your friend.
But thinking about all the different ways you could break the
code is a good way to prevent it breaking! :-)

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld/tutor2/



More information about the Tutor mailing list