469,928 Members | 1,873 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,928 developers. It's quick & easy.

Seeking advice on GUI code architecture

Qp
Hi, I've got a generic coding architecture question about an application I'm
developing. Given that I've never developed anything quite like this before
(especially not in Python), I'd appreciate any pointers that you can give
me.

The app is a network client written using Twisted and Tkinter. The clients
will connect to a server, communicate via public & private chat, and also
play simple games.

My problem is this: how do you keep your GUI code seperate from as much
underlying code as possible? As I begin, I find myself adding a lot of
intermediate code (not Tkinter, but not Twisted either) to the GUI class,
and it's beginning to clutter things up. It really seems as if I should
have a GUI class, a network class, and some separate way of communicating
between them... but I can't seem to visualize the structure in my mind.

If anyone has tips, docs, or examples, I would greatly appreciate it.

Thanks a lot.

Jul 18 '05 #1
5 1523
On Sun, 14 Mar 2004 22:29:08 -0500, Qp wrote:
My problem is this: how do you keep your GUI code seperate from as much
underlying code as possible?


In the last decade, the "pattern language" method of formalising common
architectural solutions has been increasingly popular in programming.
It is especially popular in things like interface programming, where the
architecture chosen has a dramatic effect on the efficacy and efficiency
of the program.

What you want may be the "Model-View-Controller" pattern. Others may
suggest other patterns. You would be well advised to read up on current
common patterns in interface design.

--
\ "I think a good gift for the President would be a chocolate |
`\ revolver. And since he's so busy, you'd probably have to run up |
_o__) to him real quick and hand it to him." -- Jack Handey |
Ben Finney <http://bignose.squidly.org/>
Jul 18 '05 #2
Qp
OK, I've heard briefly about MVC. I'll take a look and see if I can find
any examples of that, particularily in network client development.

Thanks,
Qp

"Ben Finney" <bi****************@and-benfinney-does-too.id.au> wrote in
message news:sl*******************************@iris.polar. local...
On Sun, 14 Mar 2004 22:29:08 -0500, Qp wrote:
My problem is this: how do you keep your GUI code seperate from as much
underlying code as possible?


In the last decade, the "pattern language" method of formalising common
architectural solutions has been increasingly popular in programming.
It is especially popular in things like interface programming, where the
architecture chosen has a dramatic effect on the efficacy and efficiency
of the program.

What you want may be the "Model-View-Controller" pattern. Others may
suggest other patterns. You would be well advised to read up on current
common patterns in interface design.

--
\ "I think a good gift for the President would be a chocolate |
`\ revolver. And since he's so busy, you'd probably have to run up |
_o__) to him real quick and hand it to him." -- Jack Handey |
Ben Finney <http://bignose.squidly.org/>


Jul 18 '05 #3
Hi Qp,
My problem is this: how do you keep your GUI code seperate from as much
underlying code as possible? As I begin, I find myself adding a lot of [...] If anyone has tips, docs, or examples, I would greatly appreciate it.


I.e. Facade Pattern may help you to keep the GUI separate from the
underlying network / business logic:
http://c2.com/cgi/wiki?FacadePattern

http://www.csc.calpoly.edu/~dbutler/.../tutorial.html

Maybe there are more patterns which may fit your needs, but Facade is
one of them which might help. ;)

Best regards,
Lars
Jul 18 '05 #4

"Qp" <qp@al.net> wrote in message
news:Zp*****************@fe03.usenetserver.com...
Hi, I've got a generic coding architecture question about an application I'm developing. Given that I've never developed anything quite like this before (especially not in Python), I'd appreciate any pointers that you can give
me.

The app is a network client written using Twisted and Tkinter. The clients will connect to a server, communicate via public & private chat, and also
play simple games.

My problem is this: how do you keep your GUI code seperate from as much
underlying code as possible? As I begin, I find myself adding a lot of
intermediate code (not Tkinter, but not Twisted either) to the GUI class,
and it's beginning to clutter things up. It really seems as if I should
have a GUI class, a network class, and some separate way of communicating
between them... but I can't seem to visualize the structure in my mind.

If anyone has tips, docs, or examples, I would greatly appreciate it.
The suggestions about MVC and Facade patterns are right on.
One thing that will help *a lot* is to provide a second UI for
your program. Make it text based for testing. That will force you
to factor out common behavior.

John Roth

Thanks a lot.

Jul 18 '05 #5
Qp wrote:
OK, I've heard briefly about MVC. I'll take a look and see if I can find
any examples of that, particularily in network client development.

Thanks,
Qp

"Ben Finney" <bi****************@and-benfinney-does-too.id.au> wrote in
message news:sl*******************************@iris.polar. local...
On Sun, 14 Mar 2004 22:29:08 -0500, Qp wrote:
> My problem is this: how do you keep your GUI code seperate from as
> much underlying code as possible?


In the last decade, the "pattern language" method of formalising common
architectural solutions has been increasingly popular in programming.
It is especially popular in things like interface programming, where the
architecture chosen has a dramatic effect on the efficacy and efficiency
of the program.

What you want may be the "Model-View-Controller" pattern. Others may
suggest other patterns. You would be well advised to read up on current
common patterns in interface design.

--
\ "I think a good gift for the President would be a chocolate |
`\ revolver. And since he's so busy, you'd probably have to run up |
_o__) to him real quick and hand it to him." -- Jack Handey |
Ben Finney <http://bignose.squidly.org/>

Take a lok at this book. Its very good:

http://www.amazon.com/exec/obidos/AS...309598-7663265

Marco
Jul 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by dlesandrini | last post: by
4 posts views Thread by Heath Kelly | last post: by
6 posts views Thread by V. Jenks | last post: by
reply views Thread by CodeMonkey | last post: by
2 posts views Thread by Joseph Geretz | last post: by
4 posts views Thread by | last post: by
7 posts views Thread by Joseph Geretz | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.