durusmail: quixote-users: OT - zodb best practices with quixote
OT - zodb best practices with quixote
2003-01-06
2003-01-07
OT - zodb best practices with quixote
Juan David Ibáñez Palomar
2003-01-07
Greg Ward wrote:

>On 06 January 2003, Michael Watkins said:
>
>
>>Initially I spent a bunch of time trying to come to grips with losing SQL
>>(specifically the query-language). I looked at IndexedCatalog and while its
>>interesting I'm trying to avoid adding the overhead it imposes unless I
>>really need it.
>>
>>
>
>The loss of a query language is irrelevant; Python becomes your query
>language.  You don't *really* enjoy embedding SQL in Python, do you?
>Unless you are a true SQL wizard, I bet you ended up using Python code
>to knit together the result of several small SQL queries to do anything
>complicated/interesting.
>
>
>

That's false.

Typically you build interfaces that show different views of
the same data, for example, "show all the members of a group"
(1) and "show all the groups a member belongs to" (2). In this
example, without a query language there are three solutions:

 1. The group object has a list with all the users that belong
    to it; then the first view is simple but the second one is
    complex.

 2. The user object has a list with all the groups it belongs to;
    then the second view is simple but the first view is complex.

 3. The group has the list of users and the user has the list of
    groups. Then both views become simple, but data is duplicated
    and you have to keep it in sync, making changes becomes
    complex and error prone.

Whe I used Bobo (which can be seen as a primitive Quixote) I had
to use any of these approaches, and it was a real problem. When
I moved to Zope the ZCatalog changed it all, now that I look back
maybe the ZCatalog is the only reason to use Zope.

With a catalog you can keep the list of users in the group class
or the list of groups in the user class, it doesn't matters. For
example if the list of users is in the group class you can index
groups by their members, then both kind of searches become simple;
and whe you modify a group you just have to remember to reindex it.

This is just a simple example, we could talk about full text indexing
and searching, etc..

Python needs a catalog. Many people like me will never leave Zope
without a catalog.



Regards,

--
J. David Ibáñez, http://www.j-david.net
Software Engineer / Ingénieur Logiciel / Ingeniero de Software



reply