MVC-type Framework in Python

John Roth newsgroups at jhrothjr.com
Wed Mar 3 16:13:09 EST 2004


"Andreas Pauley" <python-list at qbcon.com> wrote in message
news:mailman.6.1078342287.736.python-list at python.org...
> Hi,
>
> I'm interested in finding a nice way to develop applications that have
> their business logic separated from the user interface (among other
> things). This should enable easier maintenance, more flexibility and
> (ideally) less development time for the app.
>
> I've recently read about the Model-View-Controller design framework
> (originally used in SmallTalk applications, or so it seems).
> What python-specific tools/frameworks would you recommend that can be used
> to implement MVC, or something similar (or perhaps better) than MVC?
>
> I'm looking for something that can help build
> interface-independent applications, with all logic in a central place.
> There would typically be a GUI interface, character interface and
> web-based interface, all accessing the same python logic.
> The interfaces need not be python-specific. I would like, for example, to
> have an existing PHP website access the same logic.
>
> Another thing that would be nice is centralized validation.
> If you change your validation rules in one place, the interfaces get to
> know that without you having to change code on the interface.
> Is it feasible to have python extract validation rules from the database
> (e.g. a varchar(20) field) and pass that through to a gui interface that
> would limit the amount of characters entered to 20? If you then change the
> database field to a varchar(30), the change should be
> detected without having to change any other code.
>
> At the moment I'm just researching all of the different options for
> designing/implementing applications (typically multi-user database-driven
> apps), so I would appreciate any ideas. I assume some ideas have proven
> themselves more feasible in production environments than others.

Well, first off every toolkit "supports" MVC in the sense that you
can do that pattern without an inordinate amount of pain or bending
the toolkit in ways it doesn't want to go.

What you want, though, is something a little different. You want a
layered architecture where you can install different UI front ends.
The best way I know of doing this is to create an abstract UI, and
then make each of the front ends a very thin facade on that UI. It's
an interesting design problem, especially since the typical user of each
of the UI's probably has different needs.

Part of the utility of the abstract UI is that you can write FIT fixtures
that will work with it directly so that you can test out the basic
application logic from the UI perspective without having to mess with
the last step of dealing with the screen rendering.

John Roth
>
> Regards,
> Andreas.
>
>





More information about the Python-list mailing list