I guess this is getting a bit off-topic for wxPython, even if
it's about the wxPython product Mindwrapper, but there seems to
be several interested people. I'd be happy to move to another
forum if that's desired.
Thank you for your thoughtful reply. I, too, would be happy to move
this discussion to another forum if need be, but the topic has
broader implications for wxPython than SQL-mapping alone. Currently
wxPython does not implement a document-view framework, nor does it
provide built-in support for MVC or MVP architectures. So, one way
or another, nearly every wxPython app has to deal with connecting
GUI objects to persistent data, relational or not.
With your indulgence I will first respond to a few related points
by addressing them together (but out of order).
... It's trivial for programmers but I guess it might be more of
a hurdle for the non-programmers that Mindwrapper is aimed for.
... ...
I have a feeling that whatever technology we use, development
without skilled programmers is going to be problematic...
... ...
After all--the difference between a skilled programmer and
someone who is an expert within the problem domain goes far
beyond syntax. I think it's a worthwhile thing to try to create
ways to make something available to non-programmers that allows
them to do a significant part of the development they need, but
to have real expertize involved for the tricky parts is probably
a good idea.
First, let me say that Mindwrapper is NOT intended primarily for
non-programmers (despite what I said about one of your clients
possibly finding it helpful). In fact, it was originally intended
just for my own use, but along the way I was talked into making it
available to a wider audience. My purpose in releasing it as open
source now is to give something back to the community that has been
so helpful to me, and to get feedback that will help me improve it
(for others, and for my institution).
As I mentioned previously, I came to Python and wxPython out of a
deep dissatisfaction with Excel/VBA/Access. En route I tried Java
and Eiffel, but found the code/compile/test cycles too cumbersome
for my style. Python, however, "fit my mind" and fit my style
perfectly, so I thought I had found the answer.
As much as I enjoyed wxPython, however, it still seemed that the
process could be made simpler. Initially I merely wrote a few
prototype apps using wxPython, but soon I began to notice common
problems with common solutions: things like overlapping hierarchies
of nested panels and nested sizers, binding events to observable
objects, independent and dependent variables, separation of data
concerns from presentation concerns, and so on. Then I decided to
design a framework to make it easier to for me to apply these
features to every custom application I work on. The result is
(becoming) Mindwrapper.
If it turns out that Mindwrapper allows problem domain experts to
participate more actively in the development process, that would be
a good thing IMO, but that was not my primary intention. (I am a
practicing MD who happens to have a few programming skills, and in
my experience, being able to see the application from both sides of
the fence is often extremely helpful.)
Now back to the issues at hand.
Don't know ORM, but with SQLObject you write a small wrapper
class yourself to tell the code how your tables behave, what
foreign keys there are, and whether you want to use other
attribute names in Python than the column names in SQL etc. It's
trivial for programmers but I guess it might be more of a hurdle
for the non-programmers that Mindwrapper is aimed for.
The point I was trying to make is that with SQLObject, the starting
point is the table, not the object tree. Sure, it is trivial to
write the small SQLObject wrapper around the table, but then you
still need to connect the GUI to it: not difficult, but not trivial
and often tedious. It is the ease of connecting the presentation
layer to the abstraction layer that makes Mindwrapper useful to me.
A classic problem with RDBMS is to handle schema evolution, and
as far as I understand, Mindwrapper want to support incremental
development. An approach based on ZODB etc might be simpler, but
whatever the tool is, it's not trivial to evolve an application
once there is live data.
I have a feeling that whatever technology we use, development
without skilled programmers is going to be problematic... In a
way, the fixed schema of a relational database might provide a
kind of "early warning system" that might be better than more
subtle data problems caused by schema evolution in a "soft"
system such as ZODB...
First I should say that I have no immediate plans to interface
Mindwrapper to ZODB. I only mentioned it because doing so would be
more natural (and probably easier) than interfacing to an RDBMS.
Nevertheless, the Mindwrapper abstraction layer, is one that you
would likely consider a "soft" system. It is easy to add new data
elements (even complex elements) to existing data documents in
Mindwrapper (but that is true for an RDBMS as well?). Likewise,
removing a given element is no problem. Renaming elements or moving
them in the labeled tree-graph presents a more difficult problem,
but I have been working on a mechanism to allow that as well.
After all--the difference between a skilled programmer and
someone who is an expert within the problem domain goes far
beyond syntax. I think it's a worthwhile thing to try to create
ways to make something available to non-programmers that allows
them to do a significant part of the development they need, but
to have real expertize involved for the tricky parts is probably
a good idea.
Point taken (see above). But surely you wouldn't object to making
your own job easier, would you? <wink>
Donnal Walter:
> AFAIK there is no mapping that starts with a Python object
> tree and translates it into relational tables (which is a
> more complicated process).
I think we need to be able to go from the database as well, or
we will loose the ability to use existing databases. It really
varie from location to location whether SQL databases are to
be seen as a public interface or an application internal
implementation of storage.
Because my own custom applications do not start with an existing
database, I have been a bit blind to this situation until now, but
you make a good point. OTOH, I would expect it to be easier to map
a relational table into a Mindwrapper object tree than the other
way around.
But regardless of that, changing the data model once there is
existing data is non-trivial. I doubt that you can ever create a
system where you can handle non-trivial restructuring of the
data model once there is existing data that you need to preserve.
This is a difficult problem, without question, but with Python's
introspection capabilities, my untested opinion is that migrating
one object tree to another will be easier than changing a set of
relational tables.
Another problem I've seen with OO mappers is that they
typically have a very strict opinion about how to map classes
to tables. One concrete class == one table, but there are more
alternatives, and it's not obvious that 1 concrete class = 1
table is always right. With inheritance and just simple kinds
of attributes, you have at least four well know alternatives
(see http://www.ambysoft.com/mappingObjects.html ) out of which
the last (generic schema) might fit Mindwrapper best, but it
doesn't really use the relational database as it's normally done,
and I think both performance and other aspects will suffer.
Mindwrapper's information model is best described as a directed,
acyclic, labeled graph. In such a graph, there are two kinds of
branch nodes: list nodes and object nodes. *If* and when I try my
hand at mapping to relational tables, I would definitely think that
each list node would map to a separate table. Object nodes could be
mapped using any of the first three alternatives mentioned above,
or possibly some combination.
But if you have a class with attribute that are collections, like
lists or dicts, the natural solution would be to let several
tables correspond to one class, rather than to force simple
collections to have an object id for each simple value.
Yes, exactly.
···
--- Magnus Lycka <magnus@thinkware.se> wrote:
=====
Donnal Walter
Arkansas Children's Hospital