In my previous blog entry I tried to make the case for Plone
adopting Grok technology. I gave some background on Grok and talked
about some of the pain points that I think Plone has and that Grok has
been trying to tackle. My goal was to explain where Grok is coming
from, and why it's a good fit for Plone. Martin Aspeli, in a comment, wrote the following: However, there are three charges that the advocates of Grok-in-Plone
would need to counter: I'd be interested to hear your responses to these. :-) These are each good points that need to be discussed. Let me respond
to them here. The too-clever answer would be that enough people would be using
Grok if the Plone community hopped on board. :) Grok technology expands on a technology choice that Plone already
made: Zope 3. Grok is the project that is trying to make Zope 3
technology feel less esoteric. It seems to me therefore that Grok
technology is a way to make Plone's technology choices feel less
esoteric, not more. I would also be interested in hearing alternative suggestions. Are
people suggesting Plone dump Zope 3 technology? What would replace it?
Or are people saying there are better choices to make Zope 3 easier to
work with? Or are people saying Zope 3 technology as it stands is just
fine already? Grok provides a smooth upgrade path from technology that you're
already using, it has been around for two years now, and it's focused
on reducing pain points for developers. The Grok community isn't an
enormous community, but it's active and growing. I agree with the general idea that we shouldn't be making too many
esoteric technology choices. On the other hand, the Zope community on
sometimes is tackling problems that others haven't encountered
yet. The solutions will inevitably seem esoteric to some people,
because we simply were the first to get there. Grok's way of doing component configuration builds on the Martian
library. You can extend Grok in a declarative fashion. We've continued
to work on expanding Martian so that individual bits of Grok become
more declarative and less special. We're also documenting this
behavior extensively. One can make the charge that the defaulting rules that Grok's
directives (to associate a view with a context, give a name for a
view, and so on) use are too much magic. They're also the core of
Grok's convention over configuration approach. Convention over
configuration has two positive effects: If you are unsure about Grok's behavior, you can always be explicit
by writing all the directives down explicitly yourself. As to the suggestion that Grok code is hard to debug when things don't
do what you expect, I'd be interested to see some examples of this
problem. I haven't noticed things being particularly hard to debug
myself, but of course my perspective is special here. Grok ships with
a built-in introspector which should help, although we can certainly
improve it quite a bit lot more. Grok is a form of automation. One person's automation is another
person's magic. We're on guard against inconsistent automation with
lots of special cases. I think this is not a comment particular to Grok. Any new way you
introduce is vulnerable to this charge. It's inherent to the evolution
of a large framework and the tension between moving forward and
backwards compatibility, which I already described in my previous
article. Grok provides a smooth transition path at least for the Zope 3 code
that already exists in Plone. It allows a gradual transition. It's
good as this is the only way forward for a larger system with so many
users. This is bad because two ways will co-exist at the same
time. I'm not sure this can be avoided, however. As for non-Zope 3 APIs in Plone, where you need to registers with Zope
2 or the CMF, Martian technology can help there too. The Silva
project has been doing interesting work in this direction; it uses
Grok technology to register its distinctly Zope 2 content types. I think some people have the impression that Grok takes away from the
power of ZCML. They seem to think Grok is for some basic stuff, but
when things really gets tough you have to fall back on hard-core
ZCML. That's not the case. I find myself writing very little ZCML
these days. Grok isn't a simplifying layer over ZCML; it's an
alternative configuration system for the Zope 3 component architecture
that we believe is easier to use. That said, Grok allows ZCML and Grok
code to coexist just fine if you want or need to have both. Whether Grok technology, or any technology, will displace old ways
entirely in Plone is not something that is limited by the technology
itself. It is a choice the Plone developers make, and if they make it, a challenge the Plone developers must rise to.
(5) Sun Oct 19 2008 22:07 Grok tech in Plone continued:
Not enough people are using Grok; Grok is too esoteric
It's too much magic
It will be a new way that cannot entirely displace the existing ways
- Comments:
Posted by Laurent Mignon at Mon Oct 20 2008 10:01
Using Grok in plone is VERY simple. I like it because it reduce redundancy between code and ZCML.
I've integrated a beginner in my development team. It's really difficult for this kind of developer to understand why informations for a same thing is disseminated into 2 files. It's also difficult to understand why the first one is pure Python code and the second one is in XML. Using the declarative way provided by grok for adapters, utility, ... drastically reduce the complexity and facilitate the comprehension of concepts related to a component based development.
Thank you in Martijn and the grok's developers to provide us an approach facilitating the development with Plone.Posted by Lennart Regebro at Mon Oct 20 2008 15:54
"It will be a new way that cannot entirely displace the existing ways"It's not supposed to. It's supposed to be a layer to do things simply and quickly. And if you end up needing to do some special tricks that there isn't any Grok support to do, you can just do the special tricks, just as if you don't use Grok.In the same way as a HTML-editor doesn't replace hacking HTML in source, etc.
Posted by whit at Mon Oct 20 2008 16:58
Having just come off developing a webapp in Grok and a past life of Plone dev, I agree with laurent that grok requires less context shifting than zope3 or Five and for most major component types, this is much easier to read and probably easier to consume as a beginner. It is much better at achieving the classic OO goal of encapsulation in many cases.That being said, having to learn another way of doing things where the grok sidewalk ends creates a jarring context switch as one has to dive into the über-abstracted bowels of zope3. That being said, I think improving the informativeness of Grok's tracebacks and grok's coverage of zope3 concepts and plone concepts would be a wise evolutionary move for the Plone Community to contribute as the end result is a better Grok and an easier to grok Plone (w/ less lines of code). Of course, this is likely to be a bottom up change brought on by someone developing tasty features for plone using grok.
Posted by Martijn Faassen at Mon Oct 20 2008 18:35
Lennart, while Grok is of course a layer over something deeper, I don't see Grok as a simplification layer. A simplification layer to me implies restricting possibilities to make things easier to learn. Grok's configuration layer does not restrict (significantly) the possibilities that the ZCML configuration layer offers.whit, thanks for that feedback. I've been staring at some of the uber-abstracted bowels of (some) Zope 3 libraries. You can use Grok to configure these bowels, typically, unless really unusual ZCML is used that Grok doesn't support yet (which sometimes happens). The complexity is learning these bowels. Sometimes one can come up with a few simple ways to make them easier to use. Sometimes I think the right response is to consider whether we can't write better bowels that are more straightforward and easier to understand. I think with Grok we've slowly been arriving at that point. I think the publication/traversal machinery is a good candidate, but I'd like to hear about other candidates as well.
Posted by Kevin Smith at Tue Oct 21 2008 00:06
I've never had a problem debugging code built with Grok. It's always Zope Page Templates, ZCML or buildout that are a source of frustration.
