> > On 06/13/2011 02:46 PM, Markus KARG wrote:
> >> For the topic of factories itself I share Bill's opinion that
> whenever possible we should use interfaces and do not provide
> implementations. As much as possible of the implementation should be in
> the sole hands of the vendors and not already pre-programmed by the
> spec. If using a ClientFactory is the solution, then we should provide
> one. It's just the cleaner approach.
> >
> > Can you please provide an example of constructing a client instance
> with the client factory you propose? Does your
> > client factory have static methods? If yes, it must be at least an
> abstract class then, which means we are just moving
> > the problem one level of indirection further.
>
> Exactly. It doesn't matter how many factory classes we create, we'll
> need an abstract class for the static methods at some point. Earlier
> feedback on the API was related to the number of classes; adding an
> extra level of indirection seems to go against that and without any
> clear benefits IMO.
>
The clear benefit would be that if we move the problem to a single point
then everything beyond that point can be decided by the implementor. This
gives more freedom to the other vendors and it reduces the amount of code
they have to copy unchanged. For the user, the benefit is that the API is
clearly structured, as it is a difference whether something is a client
instance or a client factory.
In JPA, that single point is the EntityManagerFactory, not the
EntityManager.
In JDBC, that single point is the DriverManager / the DataSource, not the
Connection.
So in JAX-RS let's have RuntimeDelege or ClientFactory be that point, not
Client. There is just no need to merge both as they serve different
purposes. One is a factory for clients. One is a factory for endpoints.
In the end, you're having set up the EG to get those experts' opinions, so I
don't see what you problem now is with that opinions? Was there a poll among
the experts that ended with "We MUST merge ClientFactory into Client to
preserve on class?" and Bill and me just missed that?
Regards
Markus