What Zope Did Wrong
Total Page:16
File Type:pdf, Size:1020Kb
W h a t Z o p e d i d w r o n g ( a n d w h a t t o d o i n s t e a d ) Lennart Regebro EuroPython 2007, Vilnius Z o p e i s z u p e r ! ● First! ● Object oriented! ● Open source! ● Python! ● Batteries included! ● Secure! ● Easy! ● And many other exclamation marks!!! W h a t Z o p e 2 d i d r i g h t ● Used Python ● ZODB ● DTML/ZPT ● TTW development ● Easy entry into development Z o p e 2 : T h e d e a d - e n d s ● The ZODB pile of scripts ● ZClasses ● Disk-based products Z o p e 2 : T h e l e a r n i n g c u r v e Never ends Starts off easy Z o p e 2 : T h e m o n o l i t h i c l o c k - i n I t ' s u n p y t h o n i c ! ● Products instead of modules ● Way to much magick! ● Zope is the Application (not the library) ● Maybe more? Z o p e 3 : K n i g h t i n s h i n i n g a r m o u r ! Z o p e 3 : T h e l o n g m a r c h ● Development of Zope 2 slowed down ● Documentation no longer updated ● A general waiting for Godot B a c k w a r d s , f o r w a r d s o r n o t a t a l l ● Backwards compatibility – Didn't happen ● Forwards compatibility – Didn't happen – (Well, yet, at least. Could still happen) Z o p e 3 : T h e l e a r n i n g c u r v e Phew... Ugh... T o c o m p l i c a t e d <configure xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:hello="http://namespaces.zope.org/hello"> <content class=".hello.Hello"> <require permission="zope.Public" interface=".interfaces.IHello" set_schema=".interfaces.IHello" /> </content> <browser:defaultView for=".interfaces.IHello" name="edit.html" /> <browser:addMenuItem class=".hello.Hello" title="Add Hello" permission="zope.Public" for="*" /> </configure> I t ' s u n p y t h o n i c ! XML (So, not so unpythonic as people think) Z o p e 3 : A p p e a r a n c e s d e c e i v e Zope 3? Zope 3! T w o a t t i t u d e s In J2EE: In Zope 3: ● A mail service API ● A mail service API ● Implementation ● Implementation neutral neutral ● Req: J2EE ● Req: components ● Not web-only ● Not web-only The JavaMail API! zope.app.mail Z o p e 3 : C o m p o n e n t A r c h i t e c t u r e Everything is extensible and pluggable! S u r p r i s e ! zope.component is not Zope only! S u r p r i s e a g a i n ! zope.component requires no XML! Z o p e 3 : A d a p t e r s e v e r y w h e r e ! A view of an object is really an adapter between the object and the request to the IBrowserView interface. Z o p e 3 : D e a t h b y a b s t r a c t i o n ● Add a field to a schema ● Schemas are interfaces ● You need to write Python-code! ● . T o o l s n e e d t o m a k e s e n s e T h e b l a n k s h e e t ● Pythonic – Use existing modules and APIs if possible – The whole application framework is a library ● Highly modular – Pick and choose from the modules – Modify and replace internal components T h e d e v e l o p e r d i l e m m a Low entry treshold and all the power of a big framework without dead ends? Z o p e 3 : T h e l e a r n i n g c u r v e T h e l a y e r e d c a k e ! T h e l a y e r e d c a k e Information Manager TTW Layer GUI schema/form editor IT department GUI workflow editor Site developer Site Layer A CMS, ERP or similar A Web application server Application developer Application Layer Application Layer API Language Core developer Core Layer Component Architecture Loads of components T o o m u c h f r e e d o m ! How can the unexperienced choose between Genshi, Zpt and Kid T h e y d o n ' t They will start by using a finished application, like a CMS H o w c a n w e a c c o m p l i s h t h i s ? The basic things exists: Python Zope Component Architecture Zope 3 the libraries (well, soon) Grok R e p l a c e t h i s : <configure xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:hello="http://namespaces.zope.org/hello"> <content class=".hello.Hello"> <require permission="zope.Public" interface=".interfaces.IHello" set_schema=".interfaces.IHello" /> </content> <browser:defaultView for=".interfaces.IHello" name="edit.html" /> <browser:addMenuItem class=".hello.Hello" title="Add Hello" permission="zope.Public" for="*" /> </configure> W i t h t h i s : import grok class HelloWorld(grok.Application, grok.Model): pass class Index(grok.View): pass T h e h i e r a r c h y Information Manager GUI Tools IT department Site developer The CMS/ERP Application developer Grok Component Core developer Architecture.