← Back to team overview

launchpad-dev team mailing list archive

Re: Generic Colletion?

 

On 2010-07-16 22:01, Francis J. Lacoste wrote:
Hi Jeroen,
+"""A generic collection of database objects."""
This looks very cool, but how does it relate with the BranchCollection
implementation that already implements such a pattern?
This is a generic base for that kind of collection.  It wouldn't slot 
comfortably underneath the existing BranchCollection API because the 
latter exposes Storm's Select objects.  Storm doesn't really expose 
those, but you can obtain them through a private method.  My Collection 
class doesn't go that deep.
A simple but quite usable concrete collection class based on my 
Collection takes 4 lines (that's including import & docstring).  I hope 
it will facilitate lots of future instances of the collection pattern.
Here at the Platform Rally I'm talking regularly with Jamu, who 
implemented collections for Landscape.  Our approaches differ slightly, 
but are similar enough in API that the implementations would be more or 
less interchangeable.  We see merits in both.  The main difference is 
that his has more comprehensive support for specialized queries.
Our own Collection is much simpler but pushes optimization problems 
higher up: you maintain some special knowledge in your concrete 
collection, or you just use the collections differently.  We already 
have an instance of optimization through specialized knowledge in our 
pilot implementation, and it works well without complicating the normal 
case.

Jeroen



Follow ups

References