Relationship between GUI and logic?

Matthew Woodcraft mattheww at chiark.greenend.org.uk
Fri May 23 13:23:04 EDT 2008


John Salerno  <johnjsal at gmailNOSPAM.com> wrote:
> Basically, the question is this: can you write the logic behind a 
> program (whether it be a game, an email client, a text editor, etc.) 
> without having any idea of how you will implement the GUI?

You probably could, but it's best not to unless you're somehow forced
to.

In practice, the interface that you want your 'logic' layer to provide
to the GUI is likely to depend on some of the details of how the GUI
works.

If you did the lower levels first without having any idea at all of
what you were going to do with the GUI, it's quite likely that you'd
find you'd written a few functions which turned out not to be needed at
all, or that some functionality that the GUI needs to use very
frequently is rather slow to execute, or that some functionality that
you thought belonged to the 'logic' is really better done in the GUI
layer, and so on and so forth.

For example, if you were writing the 'logic' for a chess program you
might choose a way of modelling the board that can't represent a
position with more than one black king. And then when you got round to
doing the GUI you might find out that your users would like to be able
to have this temporarily when setting up a position.

-M-



More information about the Python-list mailing list