launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #04048
Re: Generic Colletion?
Hi,
On Tue, Aug 3, 2010 at 11:35 AM, Jeroen Vermeulen <jtv@xxxxxxxxxxxxx> wrote:
> On 2010-08-03 00:40, Jamu Kakar wrote:
>> I'm not convinced that "override select to take ids list into
>> account somehow" is a great idea.
>
> True. Frankly I haven't had a need yet to build custom query methods in
> concrete collections on our base; maybe that's where the customization
> should be.
>
>> I think it'll lead to mixture of
>>
>> models: you'll have a list of expressions, sometimes, with special
>> cases, sometimes, and then some glue to put it all back together. I
>
> Perhaps we shouldn't expose `select` and `refine` to anything outside the
> concrete collection, so that the caller doesn't get the flexibility but the
> implementation remains encapsulated and open to change.
'refine' is the method used to add filtering criteria, right? I'm
not sure what 'select' does, but it definitely sounds like 'refine'
is leaking implementation details to users of the collection. The
ideal situation is one where the only methods exposed to the user
are filtering methods like 'owned_by_person', 'linked_to_project',
etc., and a 'find' method to get a ResultSet.
Thanks,
J.
References