Application design

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!

Thanks for your help.

OK. Robin did not put me up to this.

I, maybe like you, am not an official coder. I do it out of love and
efficiency in my jobs. I love python and try to use wxPython when I need
a GUI.

When I read "wxPython in Action" Chapter 5, it helped me a lot. Another
good book that my programming friends have suggested is "Code Complete."

I think either of these would help you to code ... more elegantly.

thom

···

-----Original Message-----
From: Saketh [mailto:saketh.bhamidipati@gmail.com]
Sent: Tuesday, June 19, 2007 10:55 AM
To: wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] Application design

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!

Thanks for your help.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Hi Saketh,

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

···

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

Thanks for your help.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

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!

There is lots in the wiki that can help with these. For example:

http://wiki.wxpython.org/wxPython_Style_Guide
http://wiki.wxpython.org/PubSub
http://wiki.wxpython.org/wxPython_Patterns

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Ives, Thomas Wayne wrote:

OK. Robin did not put me up to this.

Not that you know of, you just didn't notice all the subliminal messages in the demo, right? :wink:

When I read "wxPython in Action" Chapter 5, it helped me a lot.

http://wiki.wxpython.org/wxPythonInAction

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!