On Wed, Apr 23, 2008 at 11:18 AM, Jan Kriesten
<[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
>  Hash: SHA1
>
>
>  hi igor,
>
>
>  | so if you want IDataProvider<A,B> A being iterator and B being model,
>  | why not do the A->B transform in iterator() itself? obviously you are
>  | caching the lookup anyways so there shouldnt be a performance hit...
>
>  there are two cases with the iterator/model mixing into one or the other.
>
>  a) separation of concerns
>
>  given the rssfeed example: in the iterator there is a list of feedurls
> (strings)
>  returned, which is a database lookup.
>
>  within model, the strings are converted in the actual rssfeed.
>
>  both are quite different tasks and could/are handled by different
> implementations.

sorry, but i dont buy this. models are not meant for factoring out
business concerns, only crosscutting concerns. so you can have the
model and the iterator wrapper delegate to the same util class that
transforms the url string to the feed.


>  b) wrapping implementation details
>
>  i have a common class which encpasulates id-lists and is provided a
> call-by-name
>  method to just do the id-lookup. this is handled by the model
> implementation and
>  isn't functional connected to the iterator at all.
>
>  your suggestion is as i understand making a B from A within the iterator.
> so, i
>  make a B from A in iterator, this object is then given to 'model' and there
> i
>  make an IdLoadableDetachableModel from it, again? that just doesn't look
> right
>  to me.
>

then your wrapper class can declare both generic types and to the
transformation internally.

>  imho there are only two ways to go:
>
>  - - drop 'model' and have iterator walk an IModel<B>

yes, that is definetely an option. the reason i did not go with this
is that it makes code uglier.

new idataprovider<t>() { imodel<t> iterator(int first, int last) {
return new modeliteratoradapter<t>(db.iterator(first, last)) {
imodel<t> model(T t) { return new ldm(t); }}}

is a lot uglier then the code you need now with a factored out model factory.

>  - - have IDataProvider one generic for iterator and one for model.

then 99% of people out there have to declare a redundant type. you are
the minority here. that is my view of course. feel free to start a
survey/vote on the user list and see which way the users want it to
go, i wont have a problem changing my mind if thats what most users
want. strong opinions held weakly and all that :)

-igor

>
>  best regards, --- jan.
>
>
>  -----BEGIN PGP SIGNATURE-----
>  Version: GnuPG v1.4.7 (Darwin)
>
>  iD8DBQFID32KLcYXCUxYsy4RAlU2AJ46YrGdkJi9mErdKnD/d7fdqiIt/QCg9ZqZ
>  AO5QSPdd8K/mM5iEe4u0rKo=
>  =9doM
>  -----END PGP SIGNATURE-----
>

Reply via email to