Saturday, 1 February 2014

The Science of Zope & Plone Form Libraries

First published on adamalton.co.uk 6th March 2010.

Now then, if you've ever used one of the magical form libraries in Plone you'll no doubt have spent a fair while trying to work out how to use the damn thing, spent a good while looking for the ellusive documentation, found some out of date article written by a German guy, used his example whilst not having the faintest idea why or how it works, and then spent a fair amount of time fighting against the form library because you needed your form to do something that the form library just didn't want to do. During that time it may have occured to you that it would be quicker to just write the damn thing by hand.  Let's look at our graph below to find out.



As we can see, the time taken to write a form by hand is approximately the same as the time taken to create the form using one of Plone's magical form libraries.  But it is clear from the shape of the graphs that using the form library involves a lot of fun and adventure, whereas writing the form by hand is just one hard slog to the finish with no excitement or emotional rolercoasters along the way. Let's have a more detailed look at the journey of writing a form using the magical Plone form library.


  1. Time spent trying to find, and then eventually reading the limited documentation, and trying to understand how the form library works.
  2. The point at which you say "bollocks to it" and you copy and paste the example code, which does some unexplained magic and somehow gives you a form.
  3. The point at which you realise you need to customise the auto-generated form because it looks shit.
  4. The point at which you realise that your form needs a file upload field, the data from which needs to be stored separately from the schema on which your form is based, and realising that you're going to have to hack the whole thing to pieces.
  5. Hacking the whole thing to pieces.  This involves: various amounts of pain and suffering, asking for advice - and being abused - on the Plone IRC channel, resorting to reading the source code, and fighting bad magic.
As you can see, the journey is full of turmoil, and you may experience some emotions during your form quest.  We can map a couple of those emotions on to the graph.



 As you can see from this graph, the level of anger is very closely related to the level of temptation to write your own Plone form library.  And this correlation between anger and wanting to write a form library may explain why all the Plone form libraries are so rubbish.



1 comment: