Read my book

I wrote a book about Webpack and React. Check it out!

Sunday, March 7, 2010

Book Review - Grok 1.0 Web Development

Disclaimer: I received a review copy of this book from the publisher, Packt Publishing.

 I had not heard of Grok before being asked to review this book. As it turns out, the framework is based on Zope. That rang a bell as Zope forms the core of the famous Plone CMS.

Compared to the popular Django, Grok is currently somewhat lesser known. Even though both Grok and Django are based on the MVC paradigm there are some vital differences between the two. It appears that by design and Zope Grok applications seem more extensible than ones written in Django. Sadly Grok appears to miss admin interface that's provided with Django by default although it would not surprise me if there was some Zope extension that fills this gap.

The description of the book states following:
  • Develop efficient and powerful web applications and web sites from start to finish using Grok, which is based on Zope 3
  • Integrate your applications or web sites with relational databases easily
  • Extend your applications using the power of the Zope Toolkit
  • Easy-to-follow and packed with practical, working code with clear explanations
I think the book manages to deliver on its promise really well. I will elaborate on this and its content in detail next.

Introduction

There are a lot of web frameworks for Python around. Grok is quite a newcomer to the market. 1.0 was released just last year around half a year ago. Zope, based on which it has been built, has been around for a significantly longer time since the 1990s.

As far as I have understood the main goal of Grok is to tap into the power of Zope and provide a developer friendly interface for it. It accomplishes this by automating a lot of tedious configuration work needed by Zope. Considering the examples shown in the book I believe it manages to do this really well.

I read the book while keeping in mind how would I accomplish the given task in Django. I set up Grok environment and gave the first examples a go. Note that even though you may feel adventurous and want to use Python 2.6+ in your development, please don't. It doesn't appear to work quite well at the moment. As the book suggests, it's safer to use Python 2.4 or 2.5 for now.

The book shows how to set up a development environment using virtualenv. Should you have some other version of Python installed, it is easy enough to point it to the desired version using the -p option.

I read through the rest and took a glance at the code provided by Packt. Even though the code has been structured well by chapter I still haven't managed to get the examples run yet. The documentation provided with the source package is a bit too sparse to be of any use.

Thoughts on Chapters

The book has been structured very well. The table of contents illustrates this well.

Throughout the chapters a simple TODO application is under development. You start out with something a bit ugly and end up with a nice, extensible application. I think it manages to showcase the main features of Grok well. The book contains enough information to get started on your own Grok projects.

I was particularly impressed by the information on ZODB. ZODB provides an object oriented persistency layer for your application. The cool thing is that it's usable even beyond Zope or Grok! I might very well find use for it in the future.

Even though Grok uses ZODB by default the book shows you how to use SQLAlchemy, an ORM, with SQLite. Relational people can have fun as well! :)

There were a few typos and such in the book but nothing too major. Overall I enjoyed the writing. The free example chapter provides a good example of it.

Checking the Claims

Now it's time to see how well the book manages to match its claims:

  • Develop efficient and powerful web applications and web sites from start to finish using Grok, which is based on Zope 3

I think the book manages to show how to do this very well. The book doubles as reference to some extent. Beyond this the official documentation of the project looks quite nice.

  • Integrate your applications or web sites with relational databases easily

This is true as well. Even though Grok doesn't come with an ORM of its own, it seems easy enough to set up one.

  • Extend your applications using the power of the Zope Toolkit

The book contains a few examples showing how to do this. So, yes.

  • Easy-to-follow and packed with practical, working code with clear explanations

Definitely. I did not have any troubles understanding the examples. I think the examples chosen did not detract from the aspects taught in any way. The prose was clear and understandable.

Verdict

I think the book surprised me a bit, in a positive way. Should I get tired of Django and find some projects it's totally unsuitable for I now have a proper alternative to look at.

It gave me more perspective on web development and showed how to achieve the same things but in a different manner. I was particularly impressed by ZODB and the way Grok has been designed to be extensible.

The book is available for purchase at Packt and Amazon though I am sure other retailers may be available as well.