Grok is a web framework based upon the Zope Toolkit (ZTK) and the Zope Component Architecture (ZCA).  Development for this framework began in 2006, with the view to making Zope-3 technology more accessible to newcomers.  It achieves this quite admirably by using a mix of convention, special Grok directives, and decorators to make the task of building and maintaining web sites really simple.

Grok's source repostory may be found on github.

A Little History

At one time Zope-2 was the darling of the Python web development world.  Zope-2 was based on a Through the Web (TTW) development model, which meant that developers could collaborate and program a Zope-2 installation remotely.  It was fast (really fast and efficient for its time), simple, intuitive and had a large number of building blocks.  To this day, Zope-2 remains popular as the basis for the Plone-3 CMS.

Zope-3, now called BlueBream, was intended to be a replacement for Zope-2, but this didn't quite work out as planned.  As fast as features were added to Zope-3, they were back-ported to Zope-2 in a compatibility library called "Five" (5 = 2 + 3). This reduced and hampered motivation for adopting the newer Zope-3 in favor of Zope-2.  At the same time, Ruby and Rails happened which completely reimagined the way people viewed web frameworks.  Django and other Python frameworks sprang up and quickly gained popularity as Python programmers began to realise that Python web development didn't have to be a ghastly chore.  The Pyramid web framework came about as an effort to make Zope technologies more accessible and less intimidating to newcomers.  Grok happened at around the same time and shared many of the same motives.

Zope-2 popularised and was popularised by TTW (Through the Web) development, but Zope-3, as was the case for most of the other Python frameworks, was not a TTW framework.

The promise of TTW development was that anyone, not just developers,  could develop web sites by adding new, or stringing together pre-defined web components online, often never having to write a line of actual code.  Today, popular site builders such as WIX or Weebly or tools like WordPress accomplish that vision.

It was arguably the confusion surrounding what Zope actually is, which brought about all of the misunderstanding, most of the confusion and much of the criticism surrounding the product.  The mistake of Zope was mostly one of branding.

Zope 4 development began more recently, and is a project to build a new TTW web platform with all the bells and whistles originally found in Zope 2.  The advances made in the Zope Toolkit are brought forward into Zope 4, and the new platform contains some new and exciting features.  This is being superceded already by Zope 5, which drops support for Python 2 & the old ZServer implementation.

So why does Grok matter?

Grok is quite possibly the best way to make use of the over 15 years of accumulated intellectual capital which comprises the Zope Toolkit (ZTK) libraries.  It is open and accessible, and its seamless use of the Zope Component Architecture (ZCA) is intuitive and simple. 

Although BlueBream exists, along with it's amazingly complete set of documentation and thoroughly tested code, the same reasons why people migrated away from Zope-3 in the first place persist today.  When the configuration (or routing) is maintained in ZCML, separate from a component's definition and implementation, this separation can lead to unnecessary complexity and poor maintainability.  ZCML was an increasingly unpopular idea, and it is unlikely that anyone would want to, nor is it entirely advisable at this stage to adopt the BlueBream framework for new projects. 

Pyramid was, at least initially, also based upon the Zope Toolkit.  However, Pyramid takes the approach of wrapping and hiding the component architecture (ZCA) from it's users, and there is not much recognisable left of the original architecture.  It tries hard to be a generalised solution for all your needs, and succeeds at this in many ways.

Grok, on the other hand, is very different.  With an initial investment of a few weeks (depending on learning speed) to properly understand how to fully exploit the Zope Component Architecture (ZCA), Grok gives you a mature and well documented framework capable of delivering relatively complex products in comparatively very little time.

What's this site all about?

This site documents it's own implementation.  All source code for this site is freely available on the web, and may be used to recreate instances of this site or to explore concepts and ideas around the Grok web framework.

To demonstrate the flexibility, utility and extensibility of Grok, this wiki uses the built in object database (ZODB) to store editable articles which describe the site itself.  From the database, we can later produce a dynamic index, or a printable book.  This site may not be perfect in every way, but it does serve its purpose in showing how a Grok site may be developed modularly using pluggable and reusable components for things like authentication, layout, menus, HTML editors and even skinning an existing site using Bootstrap or adding Disqus for comments and feedback.

The Grok tutorial does a great job at showing off the simplicity of the framework.  It is unfortunately not so good at showing how to progress beyond the simple things, or how the ZCA can help you build great sites quickly and maintainably instead of being the millstone around everyone's necks they imagine it to be.  The  ZCA is the elephant in the room everyone is ignoring which, rather than being treated like the embarrasing relative, should be the first thing proudly introduced to newcomers.

In some ways, Grok's choice of a (very cute) cave man as an emblem is so very wrong.  Whilst one understands the humour of  man with a club smashing obstacles like ZCML, the overriding association created in peoples fertile imaginations is undoubtedly that Grok, like cavemen, is a relic of a prehistoric age, working with ancient libraries and technologies.

Nothing could be further from the truth.

While one might argue that pyramids are not much newer than cavemen, one can only wonder at the marketing skills of Python developers.  This faux pas must undoubtedly have contributed to the mindset where Zope, the ZTK, Grok, and most of the related technologies belong to a bygone era.  At least the word Django has a nice modern ring to it.

The intention of this site is to serve as a testimony to Grok and the underlying Zope Toolkit, as well as the amazing work done so selflessly by the Zope, Grok & Python developers over the years, and to demonstrate that although there are a lot of newer frameworks, newer code and architectures are not necessarily always better than older code and architectures.

Grok 4 Noobs

A gentle introduction to using the Grok web framework