jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: Updated Client API and Interceptors/Filters proposal is available - please review

From: Bill Burke <bburke_at_redhat.com>
Date: Thu, 09 Jun 2011 15:29:02 -0400

On 6/9/11 8:50 AM, Marek Potociar wrote:
>
>
> On 06/03/2011 09:22 PM, Bill Burke wrote:
>> Some initial things. I'll fork on github again with my suggested changes to give you more precise feedback.
>>
>> - I don't get the point of having Client be an abstract class. Expecially since all non-static methods except close()
>> and finalize are abstract already. I suggest making ClientFactory an abstract class and making Client an interface.
>


> I don't quite understand why you push so hard for an interface in this particular case. Can you please provide more
> explanation?
>
>

I think we all understand the benefits of an interface over a class.
Once something is declared as a class I'm forced to extend it which
often leads to ugly delegation. Really, how many times have you been
pissed off because some JDK or EE thing was declared as a class and not
an interface?


Besides, classes don't belong in a specification effort. Specifications
are about specifying, not implementing unless you're defining an enum or
exception (and it sucks exceptions must be classes in Java). As it is
I'm very squeamish about classes over interfaces because I do have to
reimplement them as I'm licensing with a different open source license
(ASL, LGPL). Given the aggressive litigation history of your company,
maybe you can understand?



  I made the client an abstract class to:
>
> 1. avoid the need for a separate factory class. To me, factory class in this case is just an artificial holder of
> factory methods.
>

You need a factory class anyways. Either a new method on
RuntimeDelegate or a new ClientRuntimeDelegate class.

> 2. implement the instance disposal properly.
>

You don't trust us to write a one line finalize method?

Implementation details don't belong in a spec because my impl may want
to implement something like finalize very differently than how you
implement it. And again, legally, I have to be very careful how I
implement API classes.



-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com