Re: Criteria objects

From: Chris Uppal (chris.uppal_at_metagnostic.REMOVE-THIS.org)
Date: 08/24/04


Date: Tue, 24 Aug 2004 09:08:44 +0100

VisionSet wrote:

> I think there is a valid approach to retrieving records based on a
> criteria object that is of the same class as the object you are
> retrieving.
[...]
> Is this abuse of the object? should I have a separate criteria class?
>
> I'm after the simplest design that I do feel happy about.

Like Susdy, I think this is a valid approach (and one I've used before too).

If your sense of aesthetics, or the nature of the data, make it impossible to
indicate which of an object's attributes are part of the search template and
which are "wildcards", then you could use an auxiliary indication of which
fields to search on and which to ignore. (When I did this, I was working in C
and the attributes had a natural association with integers so it was very
simple just to use a bitmap as the "auxiliary indication", whether there is
anything as handy for you will depend on your application).

    -- chris