> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Michiel Meeuwissen
> 
> Ok, so it seems to me that a bit of consistency in the 
> interface is sacrified for the sake of performance here? Btw 
> is the toString actually called less, or only earlier?

There is a more fundamental reason: the org.mmbase.storage.search
interfaces are the minimal interfaces needed to define the interaction
between queries and queryhandlers. As it stands, the queryhandlers need
just a string representation of the values. 

In addition, the queryhandlers don't need to know how the queries were
constructed, and should not be bothered to make conversions. The burden
of validating and converting the parameters is shifted to the query
implementation classes. I think this provides a good separation of
responsibilities between the query implementation classes and the query
handlers. 

As a result, it is very hard to create an invalid query using the query
implementation classes, as these already perform all validations.

(Btw, regarding the second question: the toString conversion is done
only once, as you might expect.)

> Why should they not return Object? I think the user of the 
> get-method should decide if it has to be a String and not the 
> method itself? I understand that it is targeted at making SQL 
> of it, so probably there is only room for strings. But I 
> wouldn't be sure of that even. Perhaps you could imagine that 
> the SearchQuery object is used to fill the arguments of a 
> stored procedure, which might need other objects then String?

I'm strongly in favor of being a bit conservative when guessing what we
may need in the future. 
It'll be easy and troublefree to add such a method when need arises, and
I rather do that than trying to anticipate every conceivable future
need.
And even if we would need such a method right now, I still want to keep
the method that provides the values as string, since that is what the
present (SQL) queryhandlers need. 

BTW sorry for the delay in answering

Rob van Maris
Technical Consultant

Quantiq
xmedia & communication solutions

Koninginneweg 11-13
1217 KP Hilversum
 
T    +31 (0)356257211
M    +31 (0)651444006
E    [EMAIL PROTECTED]


Reply via email to