[wxPython-users] Application design

Kevin Ollivier kevino at theolliviers.com
Tue Jun 19 10:53:54 PDT 2007


Hi Saketh,

On Jun 19, 2007, at 9:55 AM, Saketh wrote:

> I've written a small application, but I'm not very happy with the
> code. Debugging is hampered by bad design, the structure is inelegant,
> and there is no exception handling/assertion/logging.
>
> I want to refactor and add debug code to the application, but I have
> no experience with good code design. Basically, I want to know the
> following:
>
> * Key elements that make a robust, small-scale Python application
> * How to abstract the GUI from the functionality
> * Any tips on good Python design!

I think the main thing is to follow Model/View/Controller (MVC)  
design principles as much as possible. For information on how to do  
this, I'd highly recommend you get Robin and Neil's "wxPython in  
Action" book and read chapter 5, which actually shows a complete  
example of taking a "standard" application and refactoring it to use  
MVC design principles.

I would also recommend that you consider looking at unit testing and  
Test Driven Development (TDD). I can't stress enough that writing  
tests for your code as you develop it greatly improves reliability,  
and also encourages modular design. This is also covered to a degree  
in chapter 5, and there's some more info on these subjects on the web.

Regards,

Kevin

> Thanks for your help.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users- 
> help at lists.wxwidgets.org
>





More information about the wxpython-users mailing list