frontend + backend style application design

James Mills prologic at shortcircuit.net.au
Thu Jan 8 01:05:10 EST 2009


On Thu, Jan 8, 2009 at 3:56 PM, Steven Woody <narkewoody at gmail.com> wrote:
> I am considering write an application, its core functionalities should
> be implemented in a command-line application with which a user can
> interact via its command line interface. This kind of command line
> interface can help batch usage of the application.  On the other hand,
> I still want a GUI front-end which does not implement any core
> functionality but only provides a rich GUI interface and communicates
> with the command-line back-end.
>
> I am asking you experts, in the terms of python, what
> idea/tools/module support this kind of architecture?

Quite simple really.

1. Implement all your core functionality as part of a library.
2. Implement your command-line tools that utilize this library.
3. Implement your gui that also utilizes the same library.

myproject/
|
|-setup.py
|
|-myproject/
  |
  |-__init__.py
  |
  |-foo.py
  |-bar.py
  |-gui.py
  |
  |-tools/
    |
    |-foo.py
    |-bar.py
    |-myproject.py (gu)


You can also take advantage of setuptools along with distutils
and define "entry points" for your application.

cheers
James



More information about the Python-list mailing list