[Zope3-dev] what is ZCML?
Martijn Faassen
faassen at infrae.com
Mon Mar 13 11:15:05 EST 2006
Hi there,
In this mail I'd like to make explicit some competing design influences
on ZCML.
The first interpretation of what ZCML is:
"""
ZCML is a configuration language that provides abstract directives for
configuring Zope applications. If we're setting up a page, we use the
page directive. If we're setting up a skin, we use a skin directive. If
we're setting up an adapter, we use an adapter directive.
Even if two directives underneath only set up adapters (such as
browser:page and zope:adapter), we still think it's valuable to have two
directives, as we make explicit what we are doing.
ZCML should be readable without having to consult Python code a lot.
I.e. if we set up an adapter, we know what interface it's working for
and we know what interface the adapter is providing just by looking at
the ZCML.
"""
I believe that the first interpretation is the traditional
interpretation of ZCML.
A newer interpretation of ZCML is:
"""
ZCML is a configuration language that configures a number of basic
directives for configuring the component architecture and security:
adapters, utilities, security requirements, and little else. Everything
else should be done in Python code, as configuration in Python code is
more flexible and packages can form a more self-contained whole. ZCML
should reflect the underlying universality of the component architecture.
If two directives work with, say, adapters underneath, they should
really be one directive. ZCML should be simple and minimal so it is easy
to grasp.
ZCML is not readable standalone. ZCML is simply used to turn on various
adapters and such, hooking them into the system, but we do not get a
clue what the adapters are doing by just looking at the ZCML - Python
code needs to be consulted.
"""
I believe that this interpretation is the up-and-coming interpretation
of ZCML.
(the third interpretation of ZCML is that it's evil and should be
destroyed I'd like to leave out of this discussion - the outcome doesn't
matter that much if you're of that persuasion)
Of course, these interpretations have never been made very explicit. We
have discussions where they are implicitly present, though. Reducing the
namespaces in ZCML drastically makes more sense from the second
perspective than from the first. Adding a new ZCML directive to support
annotations makes more sense from the first and doesn't make much sense
from the second interpretation.
Which one of these interpretations is the right one for the future?
I realize that the interpretations I sketch out may be extreme ends of a
spectrum. I haven't seen a lot of advocacy the removal of browser:page,
for instance. It may be that the real ZCML should be in the middle of
these two interpretations. If so we should make our criteria explicit
somehow, too - when do we really want to add a directive, and when do we
really not want to remove a directive?
Perhaps there is whole other perspective possible on ZCML that resolves
this whole issue. Let us know if you have one!
Regards,
Martijn
More information about the Zope3-dev
mailing list