Rick Hurst Web Developer in Bristol, UK


OK maybe this Zope object database makes sense now..

I’ve just made a breakthrough in my perception of Zope and its object database. Despite the fact I have been working with Plone for over three years i’ve always struggled to shift my way of thinking away from relational databases and SQL queries, due to my previous experience of building sites and applications mainly with asp (classic) and php, hooked up to a relational database.
So what caused my Eureka moment? A combination of:-

a. Not developing with plone for a while

Since going it alone I have been doing an eclectic mix of work for different agencies and companies, who all have their own pet technologies and ways of working (so far I have slotted straight into them all with a minimum of fuss- Jack-of-all-trades at your service! Except Perl. I had to turn that one down).

b. Doing a bit of old school Zope

From the moment I started with plone, when I haven’t been skinning/ templating, I have worked almost entirely with Archetypes. Archetypes generates forms for you and all the other “magic” – some lovely helpful magic, some dark voodoo that shouldn’t be spoken aloud in front of non-programmers (like me). This means that with Zope I never learned how to do a typical build a form that posts to script, script writes to database, script pulls out of database and renders it back in the page/form routine, which is usually the first thing I would learn with any other web technology/scripting language.

c. Starting to think in objects

Once again, this had more to do with not working with zope for a while. Before zope I only had a basic understanding of objects and only used them where I was forced to because I was working with someone elses code. I would encapsulate functionality by sticking a load of php/asp functions in an include file with a meaningful name, but I never took the step of wrapping them up in a class and treating the piece of functionality as an object. Something must have sunken in during my Zope years, because now I find it difficult to not think of something as an object.

So, i’m rambling – what exactly was my moment of clarity? It was simply adding a few extra fields (wait – properties) to portal_memberdata and personalize_form in Plone. I went off searching for the python script that would take the data out of the database and pump it into an object for me to use again in a page template – but of course, being stored in the ZODB, it already was an object. Z.O.D.B. Zope Object DataBase – geddit?

So in summary, I think anyone new to plone development could do with learning things the “old” way before they move onto developing with Archetypes – purely for the sake of demystifying the ZODB, especially if like me you come from a php/asp background and have trouble understanding why you would use an object database rather than a relational database.

Next stop Zope 3 – I’ve read several reports about the large amount of boiler plate code needed to create something fairly simple with Zope 3, and a few solutions to speed up the process, but I will definitely make sure to understand how it is done “manually” before attempting to move onto using any shortcuts this time.