hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: params classes vs. interfaces
Date Sun, 09 Sep 2007 11:39:25 GMT
On 09/09/2007, Oleg Kalnichevski <olegk@apache.org> wrote:
> On Sun, 2007-09-09 at 12:06 +0100, sebb wrote:
> > On 09/09/2007, Roland Weber <ossfwot@dubioso.net> wrote:
> > > Hi all,
> > >
> > > we currently have classes for defining parameter names and
> > > utility methods for setting/getting parameters in a set:
> > >
> > > o.a.h.p.HttpConnectionParams
> > > o.a.h.p.HttpProtocolParams
> > > o.a.h.nio.p.HttpNIOParams
> > > o.a.h.auth.p.AuthParams
> > > o.a.h.cookie.p.CookieSpecParams
> > > o.a.h.conn.p.HttpConnParams
> > > o.a.h.client.p.HttpClientParams
> > >
> > > Since all constructors are disabled, it is not possible
> > > to combine these classes in a hierarchy. I would like to
> > > move the definition of parameter names into a separate
> > > set of interfaces, and to arrange these interfaces in a
> > > hierarchy. And define an interface AllClientParamNames
> > > (or similar).
> > > The purpose is to allow users to locate parameters in the
> > > JavaDocs without being familiar with our "informal unit"
> > > structure. It's the last API change I have in store for
> > > core, and it would be a compatible one.
> > >
> > > Please let me know what you think.
> >
> > Are you proposing to define constants in the interfaces?
> > If so, then Joshua Bloch - he say no ;-) - see item 17 in Effective Java.
> > Interfaces should only be used for defining types, not for exporting constants.

Sorry, wrote in haste:

I should qualify that, having re-read the item: if the constants are
strongly tied to the class or interface, then it is OK to add them.

> >
>
> I think that is mainly due to the fact that lots of people tend to abuse
> interface extension to be able to import all constants at once.

Yes. The problem is that interfaces form part of the external API, and
propagate to subclasses. If a class later does not need the constants,
the interface cannot be removed without affecting binary
compatibility.

> Oleg
>
> > > cheers,
> > >  Roland
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message