Tuesday, June 11, 2002

Finally Playing around with SCS, an internal compound/component system for Zope
So a few months ago, I started working on a little compound document system for Zope. Sortof. It was being built as an internal framework of sorts, and I noticed some interesting CMF parallels, such as separation of core concepts from default implementations. The Core of this system, SCS has a lot of usable default implementations, especially of Parts -- a document is basically made up of parts, or more precisely, a root part that contains other parts.

One of the reasons I started developing this was because of the paying project I'm currently working on. In pre-bid discussions with the customer, I realized that a more flexible compound object framework was going to be needed, and that it could potentially benefit our company in other ways as well. When we hit a lull in customers paying for my work (before I went independent), I started work on the compound system, partially as a way to cut time and costs later if we got this gig.

So, we have it. And today was the first day I finally got to try out some of the concepts. What I started on late this afternoon was a Journal. Knowing that I had the SCS, all I needed was a slight specialization of the default SCS Document that would also be CMF Content. This document class, Journal, would consist of its default SCS Root part, which would consist only of Journal Entries. A Journal Entry is a subclass of the default SCS TextPart, basically with an extra created timestamp. The Journal class has a method, listEntries(), which in turn just asks its root part for all journal/* type parts, sorts them by creation date, and reverses the sort.

This is done in relatively few lines of code. Partially because the SCS Container's default listParts() implementation is rather powerful - it's a very hopped up replacement for the more traditional Zope container objectValues() method. One can pass in an IFilter object, or a function, or some keyword values, with which to query the sub-parts of a container. This could, for example, allow usage of other Part types within a Journal to hold other information without getting in the way of entries themselves.

This is different than a folder full of entries. The paradigm is different. The paradigm of folder is just that of "something which can contain anything", but the folder itself is no real special object (it can be in Zope, but few people take advantage of that fact). SCS, on the other hand, places extreme significance on the Document, the outermost object. A document contains one container (currently), and defers all sub-content related specific stuff on to it. This allows a document class to deal with other issues, such as meta data, or interfacing with a particular indexing scheme, while letting the Parts system basically take care of itself. The document is also allowed to dictate some degree of policy, like how a part or handler registry gets looked up, without (theoretically) placing TOO much burden on surrounding objects and systems.

So far, it's working. Tomorrow, I should be able to get things to a point where I can see how well this whole Journal-as-compound-document thing works out. Hopefully, it executes as cleanly as the code currently looks.
8:31:02 PM  blips[]    

Zope and Mac OS X Portal
There's a new Zope on Mac OS X portal, with links to binaries of Zope and some products (MySQL DA, TransactionAgents).
2:35:05 PM  blips[]    
Banter
Willie Nelson: We got water, coffee, and hot chocolate. What's going to happen to our image?

Johnny Cash: As long we keep wearing black, we might be alright. I don't know.
10:11:26 AM  blips[]    

Andrew Kuchlings "What's New in Python 2.3" in development
Andrew Kuchling has published an early development revision of "What's New in Python 2.3", detailing some of the work that's already been checked in, and what's no longer bound to the __future__.
9:31:28 AM  blips[]    
Is ZCML improving?
Steve Alexander points out that the ZCML file I refer to in my Intent, and human editable XML. is rather dated, and there are newer examples in the Zope 3 CVS tree. So, the situation may be improving, but with so many little ZCML files, it's been hard to track down exactly what's better. It still seems too verbose in the wrong places.
9:24:05 AM  blips[]