Don't guess, profile it.

2009/7/28 Jason Wang <jason.w...@bulletin.net>:
> Hi all,
>
> Although I am using spring-wicket to prevent the whole spring being
> serialized, It still brothers me to  see the  references in the model
> object, for example:
>
> Instead of using this:
>
> public class MyViewObjectProvider extends SortableDataProvider{
>   �...@springbean("daoService")
>    private  DAOServices daoService;
>
>    private String objectID;
>
>    public Iterator iterator(final int first, final int count){
>         .....
>      return daoService.load(objectId).subList(first,
> first+count).iterator();
>   }
>
> }
>
>
>
> I always write a singleton helper class for the service to be used, so I can
> have the model this way:
>
> public class MyViewObjectProvider extends SortableDataProvider{
>    //so no reference to the dao service object
>
>    private String objectID;
>     public Iterator iterator(final int first, final int count){
>         .....
>   //here the DAOServiceHelper.get() returns a instance that managed by
> spring(with the actual service object injected.)
>      return DAOServiceHelper.get().load(objectId).subList(first,
> first+count).iterator();
>   }
>
>  }
>
> So my question is, will there be a noticeable  performance gain to do it the
> 2nd way?
> The reason to ask is that the static kind of singleton usage is indeed
> anti-spring, and makes
> my eyes bleed....
>
> If no one has done a performance comparison, I might have to do one myself.
> Just being lazzzzzy...
>
>
> Thanks,
>
> Jason Wang
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to