← Back to team overview

launchpad-dev team mailing list archive

Re: Generic Colletion?

 

On 2010-08-02 18:35, Julian Edwards wrote:

Based on some of the text in https://dev.launchpad.net/Collections I am also a
bit concerned that there's some overlap with our utility IXXXSet classes.

There should be, yes. A Collection should be less of a dumping ground for "objectless" functions related to a class and more of a lightweight and flexible way to construct various kinds of sets and subsets.


"Which will mean that you can getUtility(IAllFoo) to start working with a
collection. "

This is functionally identical to getUtility(IFooSet) which is our existing
pattern for collections (and there's webservice exports for those too).

If you already have a utility for Foo, I don't suppose there's any need for a separate IFooCollection utility. You could either make the collection a base class there or return it from a utility method.

One thing that might be nice to add is a shorthand method for "get by id." That's something we keep needing again and again anyway.


Jeroen



References