Building a GUI agnostic database application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rasjid Wilcox

    Building a GUI agnostic database application

    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/computin...on/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.

  • Uwe Grauer

    #2
    Re: Building a GUI agnostic database application

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

    Uwe

    Rasjid Wilcox wrote:[color=blue]
    > 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/computin...on/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.
    >[/color]

    Comment

    • Brian Kelley

      #3
      Re: Building a GUI agnostic database application

      Uwe Grauer wrote:[color=blue]
      > Take at look at PAF http://www.dctools.org
      >
      > Uwe
      >
      > Rasjid Wilcox wrote:
      >[color=green]
      >> 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.[/color][/color]

      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(sel f,user,item,cos perunit,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

      Comment

      • Rasjid Wilcox

        #4
        Re: Building a GUI agnostic database application

        Uwe Grauer wrote:[color=blue]
        > Take at look at PAF http://www.dctools.org[/color]

        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 Kelley wrote:[color=blue]
        > 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.[/color]

        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.

        Comment

        • Brian Kelley

          #5
          Re: Building a GUI agnostic database application

          Rasjid Wilcox wrote:[color=blue][color=green]
          >>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.[/color]
          >
          >
          > 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.
          >[/color]
          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.sourcefor ge.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

          Comment

          Working...