Building a GUI agnostic database application

Brian Kelley bkelley at wi.mit.edu
Thu Dec 4 12:02:15 EST 2003


Rasjid Wilcox wrote:
>>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.
> 
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





More information about the Python-list mailing list