In general separation of construction and use is always a good thing (tm).

As the query is just an expression tree applied to a source or rendered to a
query language representation it shouldn't rely on the query source for 
construction.

Except when using generic type information for typesafe dsl (fluent) like api 
based on
the actual type of the iterator source. That could then also be achieved by 
giving
the class (or an instance) of the data type to start the query on.

Michael

Rickard Öberg schrieb:
> Hey,
> 
> During a seminar yesterday I got the question of why Query source 
> selection is done in the builder and not the Query. I didn't have a good 
> answer.
> 
> Here is the code we are talking about. QueryBuilder:
> Query newQuery();
> Query newQuery(Iterable source);
> ---
> The alternative would be to have only newQuery() in QueryBuilder(), and 
> then have 
> find()/find(iterable),iterator/iterator(iterable),count/count(iterable) 
> in Query. The good thing about this is that Queries can be created as 
> domain concepts more easily and then strung together later on using the 
> iterable versions of query. This approach is similar to LINQ (I'm told) 
> where building the query graph is done separately from applying it to a 
> collection/database.
> 
> Any thoughts on this?
> 
> /Rickard
> 
> 
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev


-- 
Michael Hunger
Independent Consultant

Web: http://www.jexp.de
Email: [EMAIL PROTECTED]

Enthusiastic Evangelist for Better Software Development

Don't stop where you are: http://creating.passionate-developers.org
We support Software Engineering Radio (www.se-radio.net)

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to