[Zope3-dev] Re: ZCML

Martijn Faassen faassen at vet.uu.nl
Tue Aug 26 23:22:41 EDT 2003


Chris Withers wrote:
> Stephan Richter wrote:
> >This would totally bloat ZCML and make it unworkable. I mean theory is 
> >nice, but Zope is a software, so we have to look at the practical side of 
> >things. If ZCML fulfills all XML semantics but is unusable, we lost 
> >everything we tried to accomplish.
> 
> I'm still not really convinced by the whole XML thing anyway.
> 
> Surely a class structure would be just as convenient a way of building up 
> this kind of information, with subclassing being used for overriding and 
> reconfiguring on the fly?

Could you give some code examples on how you'd map ZCML onto a Python
class structure? Including an example of subclassing being used for
overriding and reconfiguring on the fly. It's not directly obvious to me.

Anyway, ZCML is a separate language because:

  * glueing together components is something a site developer might
    do. This may be a separate person from a component developer.
    A separate language for this activity may be useful.

  * if configuration were in Python, we'd run a number of risks;
    everybody might start growing their own way to do configuration.
    Configuration information might then be hard to access programmatically.
    Also it's just hard to maintain if configuration information is mixed
    along with actual functionality.
    We have plenty of examples of the problems in Zope 2.

  * having a separate language makes it easier to think about configuration
    as a separate topic, which is particularly important in a system where
    so much detailed configuration is possible.

I realize you're proposing a special way to use Python structures 
to represent configuration so you may have less of these issues (I have
no idea really as I can't really imagine what you're proposing here). I will
say that using classes to represent configuration information is more obscure
than using XML and will not make things magically easier to learn.

Anyway, a separate issue is why the use of XML. XML has a number of
disadvantages:

  * relatively bloated

  * while human readable not really that nice to read or write.

  * not that natural a way to model data sometimes.

  * all kinds of aspects of standards shouldn't have been done 
    that way, what were they thinking, etc.

  * lots of hype

but XML has a bunch of nice advantages:

  * well known, lots of documentation

  * better than CSV format, and unicode for the masses

  * lots of available tools, libraries, etc

  * lots of people use it

  * can handle tree structures fairly well.
 
  * does make one think about semantics

Those factors make it worthwhile to use it. I think eventually perhaps we
can come up with a shortcut non-XML syntax for ZCML, but so far XML has
brought us quite a way. We didn't need to write and debug our own parsers 
either. Emacs's SGML mode does some highlighting. I can write a schema to
capture ZCML use in practice. I expect the XML property will allow us to do
other things in the future with relatively little hassle using standard
tools, such as transform it and searching in it.

But ZCML certainly isn't perfect. My schema effort hopefully will help
capture a bit of information on how it's used and may suggest some ways to
improve it.

Regards,

Martijn





More information about the Zope3-dev mailing list