[Tutor] Re: Newbie project, possible?

Magnus Lyckå magnus@thinkware.se
Wed Jun 18 04:14:04 2003


At 04:17 2003-06-18 +0200, Andrei wrote:
>but I for one don't write engine first, GUI second and I also don't often 
>(or ever) use the engine from the command line.

But GUI development with Python, for instance using wxPython,
is often more complex than producing the underlying logic. You
can't get away from using classes, and there are a lot of little
non-obvious things that have to be done right to get it to work.

That's the main reason I see to postpone the GUI programming in
this case. But you have a point that parallel development makes
sense as well... As a beginner you are probably unlikely to
predict exactly what kind of API you need between the logic and
the GUI before you even start writing the GUI. But with Python,
it's typically quick to rewrite code that doesn't fit the bill. :)

I try to use the unittest module to write unittests for my logic.
It's probably a good idea to write unit tests before you write
the code you plan to test, for two reasons:

1. Writing tests becomes part of the design process, a way of
    defining interface (API) and functionality.

2. If you postpone writing test code until the program is working
    it's very likely that it won't happen at all.

It's really a good idea to have a suite of unit tests for your code,
and to run it regularly while doing development. It will make you
notice much faster if you had made a change that broke some other
part of the system.



--
Magnus Lycka (It's really Lyckå), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The Agile Programming Language