By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,908 Members | 1,860 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,908 IT Pros & Developers. It's quick & easy.

Advice from senior Members

P: n/a
Hello All,

I am looking for some experience from the senior members.
Now I am doing a simple desktop application, this application will
have 3 main functions:

1- Read information about the desktop system;
2- Interact with the user;
3- Send information to a server.

The first part, reading information about the desktop system, is
already done.
And now I am starting to make the gui for the user, that is when the
question appear:
"What is the best way to make it? divide in files? by classes or
functions?"
I have now one big file with all functions to get the desktop
information.
Should I make one file for the visual functions (wxpython)? another
for the server?
Is productive to divide in files? what is the best way?

It seems like a naive question, maybe easy one, but I am willing to
enjoy the experience from the most senior programmers here.

Thanks
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On May 23, 8:02*am, flit <superf...@gmail.comwrote:
Hello All,

I am looking for some experience from the senior members.
Now I am doing a simple desktop application, this application will
have 3 main functions:

1- Read information about the desktop system;
2- Interact with the user;
3- Send information to a server.

The first part, reading information about the desktop system, is
already done.
And now I am starting to make the gui for the user, that is when the
question appear:
"What is the best way to make it? divide in files? by classes or
functions?"
I have now one big file with all functions to get the desktop
information.
Should I make one file for the visual functions (wxpython)? another
for the server?
Is productive to divide in files? what is the best way?

It seems like a naive question, maybe easy one, but I am willing to
enjoy the experience from the most senior programmers here.

Thanks
I would investigate the MVC (model-view-controller) architecture. That
is what wxPython advocates as does TurboGears and Django. The idea is
to keep your view (the GUI) separate from the logic (the controller)
and (I think) the model controls the data access.

Anyway, it's explained much better at these sites:

http://wiki.wxpython.org/ModelViewController
http://wiki.wxpython.org/wxPython%20Patterns
http://en.wikipedia.org/wiki/Model-view-controller

I try to keep my GUI code as decoupled from my logic code as possible.

Mike
Jun 27 '08 #2

P: n/a
flit <su*******@gmail.comwrote:
I am looking for some experience from the senior members.
Now I am doing a simple desktop application, this application will
have 3 main functions:

1- Read information about the desktop system;
2- Interact with the user;
3- Send information to a server.

The first part, reading information about the desktop system, is
already done. And now I am starting to make the gui for the user,
that is when the question appear: "What is the best way to make it?
divide in files? by classes or functions?" I have now one big file
with all functions to get the desktop information. Should I make
one file for the visual functions (wxpython)? another for the
server? Is productive to divide in files? what is the best way?
I would divide it into 3 files, one for the desktop info, one for the
server interaction and one for the GUI. Subdivide the files if they
start getting unmanageably long

My wx programs tend to be full of lots of little classes. I make
every object (pane, window, widget etc) its own class and glue them
all together in other classes.

I'd make your read the information file into probably a single class,
with each function a method. You can then either read all the
information on __init__ or as methods whichever seems best to you.
Your gui classes will then query this as appropriate (this is the MVC
as discussed by another poster).

You can write another text mode interface for the desktop info module
which prints things out in text format for testing.

Once you've divided your program up, you can start thinking about unit
tests. You can certainly unit test your desktop info gathering, and
your server interaction. It is hard to write tests for wx GUIs though
(but not impossible).

When you've finished you'll have 3 files full of classes. You may
have a few utility functions too.

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.