[XML-SIG] Re: Maki: great!

Sam Brauer sam@webslingerZ.com
Tue, 19 Feb 2002 13:58:40 -0500 (EST)


> Date: Tue, 19 Feb 2002 14:51:39 +0100
> To: xml-sig@python.org
> From: Alessandro Bottoni <abottoni@quadrante.com>
> Subject: [XML-SIG] Maki: great!
>
> I just discovered Maki (http://maki.sourceforge.net/), thanks to Nicolas
> Chauvat. Please, allow me to congratulate Sam Brauer for this very
> interesting project and thank him for having donated this high-quality
> software to the public domain.

Thanks for your enthusiastic comments!
I'm a little embarrassed (as I feel that the documentation, examples, and
packaging of the project are less than adequate).

>
> Now, a few comments:
> 1) I found interesting the idea to use embedded Python code for creating
> dinamic XML pages. I think this solution is simpler and probably faster to
> process than the complicated XSP (XML Server Pages) used by Cocoon (see:
> http://xml.apache.org/cocoon) but I would like to hear the opinion of the
> other partecipants of this list regarding this topic. Is an embedded
> scripting language better than a XML-compliant page format for creating
> dinamic web pages? How about content/logic separation? How about developer
> friendliness?

I find it to be quite developer friendly.  You can make changes and test
them very quickly, and you have the full power of Python at your disposal
to produce the dynamic content.

Regarding content and logic separation, you can make them quite separate
by writing logicsheets (or "taglibs") that are specific to your project.

For example, on a project I am working on now I have a database
abstraction layer that maps Python objects to tables in a SQL database.  I
have written various methods that allow me to retrieve objects that match
certain conditions, and each class has a method toSaxEvents(handler) that
writes out a representation of the object via SAX events.  (When maki
evaluates objects to serialize them into an XML document, it tries to call
toSaxEvents() if the object has such a method, otherwise it uses a
default method that handles built-in Python types in a sane manner and
calls str() on objects without a toSaxEvents method.)

In xml documents to be processed by maki, I _could_ directly embed Python
code that operates on the objects and adds them to the document by running
a process step.

Or I can make up a set of tags that declare what objects I want to
retrieve (including a list of conditional and/or sort criteria expressed
by multiple nested tags, for example).  In that case, I would write a
logicsheet (xsl stylesheet) that matches those tags and transforms them
into maki tags that execute and evaluate the Python code necessary to
retrieve those objects.  My input XML documents can then contain my custom
tags, and I can pass the document through a stylesheet step that replaces
those tags with the maki tags, then pass that output into a process step.

If you use a logicsheet approach like this, you can achieve a high degree
of content/logic separation, since your input xml documents declare what
content you want and leave it up to your logicsheet to actually do the
work to get the content.

maki doesn't force you to do it either way.  You have the flexibility to
decide what best suits your needs.

In general I tried to write maki such that it would be flexible and not
force any particular style of usage.

>
> 2) On the basis of Maki, it would be a very good idea to develop a "Portal
> system" like "Cocoon Portal" (see:
> http://www.need-a-cake.com/stories/2002/02/14/cocoonPortalFirstLook.html).
> This would make much easier and faster to create Python/XML/Maki-based web
> sites and would allow for a wider acceptance of these technologies. Anybody
> is thinking/working on such a system?

That looks pretty neat.  I'm sure one could create something similar on
top of maki/mod_python.  I haven't thought about it myself (and don't
really have the time or immediate need to).

>
> 3) Does anybody use Maki in a production environment?

So far I've only used it in a production capacity for intranets, although
I'm in the process of creating a rather large scale public site on it.
Whenever that goes live (which won't be until late summer or early fall)
I'll most likely announce it on the maki homepage.

> How about performance
> and stability?

maki itself seems to be quite stable if the software it depends on
(mod_python, Python, and whatever xslt extension(s) you use) are stable
and installed correctly.
Similar with performance...  If your xslt processor is fast and the Python
code your pages execute is fast, then your site should perform well.

libxslt is the fastest xslt processor I've used under Python so far.
Unfortunately at the moment I am having trouble trying to use it with
maki.  Hopefully this will clear up soon as development on the two Python
interfaces to libxslt continues.  In the meantime, I'm using Sablotron and
it's pretty speedy.

Regarding speed of Python code, I'm finding that trying to achieve high
performance and at the same time achieve a high separation of content and
logic can be tricky.  Adding layers of abstraction to your code tends to
make it slower.  Logicsheets can hide a lot of the complexity, but become
rather complex themselves if the code they make calls to is not very
abstract.

To wrap up, you are taking a risk by using maki (since I haven't even
deployed it yet on a large scale public site), but I hope that doesn't
prevent people from trying it out.  It should only get better over time.

- Sam Brauer
http://maki.sf.net/