Building a GUI agnostic database application

R

Rasjid Wilcox

I am wanting to write a database application using Python.

I want it to be GUI agnostic. The GUI will probably be Python/wxPython, but
I would also like the option of a Webbased (PHP?) gui, and possibly GUI's
in Java or C++, Visual Basic etc.

The Python 'backend' may run on the same machine as the client (thick
client), or on the same machine as the database (thin client).

My main requirements are:
1. Reasonably light-weight
2. Secure authentication between the GUI and the backend.
3. Ideally runs wherever Python runs, and at least on Linux, Mac and
Windows.

http://www.markcarter.me.uk/computing/python/python.html has a list of
possible candidates.

These include:
Corba, OSE, SOAP, Spread, Twisted, XML-RPC and Yami

It looks to me like XML-RPC run over SSL is probably the simplest solution,
but I'd be interested in other peoples views.

Thanks,

Rasjid.
 
B

Brian Kelley

Uwe said:
Take at look at PAF http://www.dctools.org

Uwe

Why not just make a database model that doesn't know anything about the
GUI? The model can a python compliant database driver (say odbc or
whatnot) and you can supply the proper business logic in a concise model.

For example

class model:
def connect(self,...)
def adduser(self,...)
def addPurchase(self,user,item,cosperunit,units):

Now using this database model you can control it with a webbased gui or
a wxPython gui. I don't think that there is a need to use a wire
protocol in this case to attach to your database code which itself uses
a wire protocol to attach to the database. Just consolidate your code
into a model.

This is a typical model->view->controller approach. In my experience
the best way to program this is to write the model first without using a
gui, just a lot of test cases. Once the model does what you want, hook
it up to a gui. This helps to ensure that the model works in at least
two independent environments, the python interactive environment and
also your gui code.

Brian
 
R

Rasjid Wilcox

Uwe said:

Interesting. Should I worry about it only being a 0.1 release? Is it
mostly just a packaging of several existing established components, or is
it something more than that. It does seem to cover pretty much everything
I was thinking about.


Brian said:
Why not just make a database model that doesn't know anything about the
GUI? The model can a python compliant database driver (say odbc or
whatnot) and you can supply the proper business logic in a concise model.

This is _precisely_ what I was planning to do.

The issue is that the 'client' program (GUI or text based interface or some
other scripted component or whatever) may or may not be running on the same
machine as the 'business logic' backend component, which may or may not be
on the same machine as the database.

I am aware that there are several frameworks around that resolve this
problem, and am just having trouble working out which to choose. I guess
what I'm really after is some pro's and con's of the alternatives.

I probably did not phrase the original question clearly enough. Although I
understand the concepts, I'm still learning the lingo.

Cheers,

Rasjid.
 
B

Brian Kelley

Rasjid said:
This is _precisely_ what I was planning to do.

The issue is that the 'client' program (GUI or text based interface or some
other scripted component or whatever) may or may not be running on the same
machine as the 'business logic' backend component, which may or may not be
on the same machine as the database.
This can still be handled the same way.

Version I

View
^
|
v
Controller <--> Model

Version II

View
^
|
v
Controller <-> (Adapter <-> wire protocol <-> Model)

Now, if the Adapter behaves exactly the same as the oroginal Model you
are in luck and you can replace I with II without ever having to change
the view and the controller.

Of course, this means you will need a good Model to start with the
enables it being used as an Adapter.

A good wire protocol that I have used in the past is pyro
(pyro.sourceforge.net) that almost seamlessly wraps python objects and
can use them remotely. As long as you don't use your model in ways that
pyro can't you can transparently replace the model with the remote calls.

Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top