You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Daniel F. Savarese" <df...@savarese.org> on 2011/04/15 16:48:56 UTC
[net] binary compatibility be damned
Prior to the 3.0 release, I'm trying to review recent code changes and
test the code in what little spare time I have available. I noticed that
ProtocolCommandSupport __commandSupport was moved into SocketClient.
I disagree with this change. SocketClient isn't meant to serve only
Commons Net classes, nor is it meant only for implementing clients for
IETF protocols; and only a limited number of clients actually need
to use ProtocolCommandSupport. Having a private member variable that is
initially null that must be initialized outside of the base class via calling
createCommandSupport to initialize is fragile. That's what constructors
are for. Even though Java doesn't have destructors, avoiding initialization
protocols and using RAII is still a good rule of thumb for resource creation.
A more robust and flexible separation of concerns would place the
ProtocolCommandSupport member in a ProtocolClient abstract class that
subclasses SocketClient and initializes __commandSupport (which should
be protected, not private, obviating the need for getCommandSupport())
in its constructor. Then the protocol clients that require
ProtocolCommandSupport can be changed to subclass ProtocolCommandSupport.
That won't break compilation of any user code, but breaks binary compatibility.
Emphasizing binary compatibility at the expense of design doesn't make sense
to me. Commons Net is enough of a Rube-Goldberg machine as it is.
Is there some overriding reason why binary compatibility absolutely must
be maintained or may I open an issue and make the above change?
daniel
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by Jörg Schaible <jo...@scalaris.com>.
Jochen Wiedmann wrote:
> On Tue, Apr 19, 2011 at 10:16 AM, Torsten Curdt <tc...@vafer.org> wrote:
>
>> * source compatibility for x.*.*
>
> Disagreed. I can quote numerous examples of application servers that
> come with varying versions of commons-foo, even within my employers
> house. Your proposal would mean that I had to create varying jar files
> of the applications shared library, depending on the application
> server.
>
> I am quite happy with our current policy, that we either maintain
> binary compatibility or change the package name. OTOH, I do support
> every attempt to drop old stuff by doing the latter.
+1 for same reasons
- Jörg
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by sebb <se...@gmail.com>.
Many applications rely on a single class-loader.
Not all applications can easily be changed to use multiple
classloaders, and anyway I don't think Commons should force end-users
to use multiple class-loaders to fix compatibility issues.
Since a single class loader can only load a single instance of a given
class, this implies that Commons releases must be binary compatible.
If the release is not binary compatible, the new release must use a
different class/package name to allow the old and new classes to
co-exist in the same classloader.
This approach solves the loader problem for applications that may
indirectly depend on more than one version of a single jar.
Changing a class/package name is pretty cheap for the developer of a
component; generally this can be automated by the IDE or a script.
However the total downstream cost is potentially much greater, as
every user who wishes to use the new version needs to update their
code and recompile. For a popular component such as Lang, this may
mean changing a very large number of other codebases.
The cost of maintaining binary compatibility needs to be weighed
against the cost to downstream users.
Yes, sophisticated users can employ tactics such as OSGI, shading, or
multiple class-loaders to get round the classloader issue, but I do
not believe that Commons components should force this on end-users.
Commons components are intended to be widelty reusable; to ensure that
this is true we need to take care that the APIs are stable and
releases are compatible.
When we do need to break with the existing API, it needs to be done
carefully (and infrequently) so as to minimise the effect on
downstream users.
I'm not saying that binary compat overrides all other considerations,
but I think we need to consider the cost to downstream users very
carefully before embarking on changes that affect them all.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by Torsten Curdt <tc...@vafer.org>.
>> Why are you using the jars from the app server would be my question.
>
> * Because I wouldn't want to modify the installation?
> * Because I'd like to deliver my application to customers so that they
> can deploy in an unmodified environment?
> * Because it works fine that way with the current policy?
>
> Pick your choice.
No need to modify the installation. Just a matter of class loading.
>> IMO that's irrelevant as the users decide whether they upgrade or not.
>
> You don't get the point. With the commons libraries, there frequently
> isn't *the* user. In the scenario I outlined above, there are at least
> 3 different "users" (from a commons perspective):
>
> - The quality managers and or programmers that decide what's
> destributed as part of the application server.
> - The application programmers (like me), that build generic
> applications which are running within this application server.
> - The customers programmers which are customizing or using the
> applications I have built.
Not sure why customers programmers matter here. There really is just
one "user" - the guy that picks the version number. That can be you or
the customers programmer. The containers jar shouldn't really be
relevant if your app is setup correctly.
> Decisions aren't done unilaterally.
If you don't want the control you have to deal with what the container
gives you. Then the container becomes part of you project dependency.
Otherwise it's just that user type guy picking the version.
Anyway ... that were already 3 cents.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by Jochen Wiedmann <jo...@gmail.com>.
On Tue, Apr 19, 2011 at 3:41 PM, Torsten Curdt <tc...@vafer.org> wrote:
> Why are you using the jars from the app server would be my question.
* Because I wouldn't want to modify the installation?
* Because I'd like to deliver my application to customers so that they
can deploy in an unmodified environment?
* Because it works fine that way with the current policy?
Pick your choice.
> IMO that's irrelevant as the users decide whether they upgrade or not.
You don't get the point. With the commons libraries, there frequently
isn't *the* user. In the scenario I outlined above, there are at least
3 different "users" (from a commons perspective):
- The quality managers and or programmers that decide what's
destributed as part of the application server.
- The application programmers (like me), that build generic
applications which are running within this application server.
- The customers programmers which are customizing or using the
applications I have built.
Decisions aren't done unilaterally.
Jochen
--
I Am What I Am And That's All What I Yam (Popeye)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by Torsten Curdt <tc...@vafer.org>.
>>> * source compatibility for x.*.*
>>
>> Disagreed. I can quote numerous examples of application servers that
>> come with varying versions of commons-foo, even within my employers
>> house. Your proposal would mean that I had to create varying jar files
>> of the applications shared library, depending on the application
>> server.
Why are you using the jars from the app server would be my question.
> We should not expect downstream users to change to a new binary API
> (new package) more than (say) once a year, if that.
IMO that's irrelevant as the users decide whether they upgrade or not.
Never change a running system. If you do - well, stuff might break.
Whoever is serious about avoiding jar hell inlines his dependencies anyway.
(see maven shade plugin)
cheers,
Torsten
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by sebb <se...@gmail.com>.
On 19 April 2011 09:33, Jochen Wiedmann <jo...@gmail.com> wrote:
> On Tue, Apr 19, 2011 at 10:16 AM, Torsten Curdt <tc...@vafer.org> wrote:
>
>> * source compatibility for x.*.*
>
> Disagreed. I can quote numerous examples of application servers that
> come with varying versions of commons-foo, even within my employers
> house. Your proposal would mean that I had to create varying jar files
> of the applications shared library, depending on the application
> server.
I agree that we should strive for source compatibility within a major release.
There may be some source changes that could be allowed (e.g. dropping
an obsolete constant) within a major release, but in general I agree
we should have a major version bump for updates that require source
changes.
> I am quite happy with our current policy, that we either maintain
> binary compatibility or change the package name. OTOH, I do support
> every attempt to drop old stuff by doing the latter.
Agreed in principle, but not if there are drip feed changes.
We should not expect downstream users to change to a new binary API
(new package) more than (say) once a year, if that.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by Jochen Wiedmann <jo...@gmail.com>.
On Tue, Apr 19, 2011 at 10:16 AM, Torsten Curdt <tc...@vafer.org> wrote:
> * source compatibility for x.*.*
Disagreed. I can quote numerous examples of application servers that
come with varying versions of commons-foo, even within my employers
house. Your proposal would mean that I had to create varying jar files
of the applications shared library, depending on the application
server.
I am quite happy with our current policy, that we either maintain
binary compatibility or change the package name. OTOH, I do support
every attempt to drop old stuff by doing the latter.
Jochen
--
I Am What I Am And That's All What I Yam (Popeye)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by Torsten Curdt <tc...@vafer.org>.
With a version of x.y.z I think it would be sane to expect...
* binary compatibility for x.y.*
* source compatibility for x.*.*
* no compatibility whatsoever for *.*.*
* but *.*.* releases should not clash
I don't think we should cater for any other kind of user stories. If
it's a user wants to upgrade without thinking then that's no user
story I think it's worth supporting.
My 2 cents
cheers,
Torsten
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by Jörg Schaible <jo...@gmx.de>.
Daniel F. Savarese wrote:
>
> I guess I had more to say, or rather ask.
>
> In message <BA...@mail.gmail.com>, sebb
> writes:
>>really necessary, because of the additional work that it causes all
>>downstream users.
>
> What additional work? As far as I know, end users--as in people who don't
> write code--don't download new versions of Commons Net jars and plug them
> into the applications that they use. They don't even know the
> applications
> they use depend on Commons Net. Developers of the applications they use
> update the jars when they release a new version of their software and
> deliver it to their users. Developers are our downstream users and they
> compile their code before releasing it. So as long as we remain
> compile-time compatible, there's no problem. What am I missing? That's
> not a rhetorical question.
An application that depends on two components that themselves require two
(binary incompatible) commons net versions.
> I must be missing some use case you have in mind, such as something
> analogous to a Linux distribution updating /usr/lib/libstdc++.so or some
> other shared library and breaking all dynamically linked user-compiled
> binaries dependent on it. The only Java examples of that I can think of
> are the result of lack of care in deploying applications (where you
> end up pulling jars into your CLASSPATH that you don't intend).
You can no longer care in the situation above, it simply does not work.
- Jörg
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by sebb <se...@gmail.com>.
On 18 April 2011 21:40, Henri Yandell <fl...@gmail.com> wrote:
> On Mon, Apr 18, 2011 at 1:35 PM, Daniel F. Savarese <df...@savarese.org> wrote:
>>
>> I guess I had more to say, or rather ask.
>>
>> In message <BA...@mail.gmail.com>, sebb writes:
>>>really necessary, because of the additional work that it causes all
>>>downstream users.
>>
>> What additional work? As far as I know, end users--as in people who don't
>> write code--don't download new versions of Commons Net jars and plug them
>> into the applications that they use. They don't even know the applications
>> they use depend on Commons Net. Developers of the applications they use
>> update the jars when they release a new version of their software and
>> deliver it to their users. Developers are our downstream users and they
>> compile their code before releasing it. So as long as we remain
>> compile-time compatible, there's no problem. What am I missing? That's
>> not a rhetorical question.
>>
>> I must be missing some use case you have in mind, such as something
>> analogous to a Linux distribution updating /usr/lib/libstdc++.so or some
>> other shared library and breaking all dynamically linked user-compiled
>> binaries dependent on it. The only Java examples of that I can think of
>> are the result of lack of care in deploying applications (where you
>> end up pulling jars into your CLASSPATH that you don't intend).
Exactly - that is the problem.
If you have full control over all the jars and dependencies in your
application, then binary incompatibility is a one-off correction every
time you replace a jar with an incompatible later version.
But if you cannot recompile all the source code, then incompatible
jars can cause your application to break, and you won't be able to fix
it.
> My understanding is that we want to protect people who update without
> doing any testing (or recompiling).
We want to protect against jar hell.
> Personally I agree with you, our stance on binary compatibility is
> entirely too dogmatic and leads to stagnant outdated codebases.
No, it's pragmatic.
> Hen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by Henri Yandell <fl...@gmail.com>.
On Mon, Apr 18, 2011 at 1:35 PM, Daniel F. Savarese <df...@savarese.org> wrote:
>
> I guess I had more to say, or rather ask.
>
> In message <BA...@mail.gmail.com>, sebb writes:
>>really necessary, because of the additional work that it causes all
>>downstream users.
>
> What additional work? As far as I know, end users--as in people who don't
> write code--don't download new versions of Commons Net jars and plug them
> into the applications that they use. They don't even know the applications
> they use depend on Commons Net. Developers of the applications they use
> update the jars when they release a new version of their software and
> deliver it to their users. Developers are our downstream users and they
> compile their code before releasing it. So as long as we remain
> compile-time compatible, there's no problem. What am I missing? That's
> not a rhetorical question.
>
> I must be missing some use case you have in mind, such as something
> analogous to a Linux distribution updating /usr/lib/libstdc++.so or some
> other shared library and breaking all dynamically linked user-compiled
> binaries dependent on it. The only Java examples of that I can think of
> are the result of lack of care in deploying applications (where you
> end up pulling jars into your CLASSPATH that you don't intend).
My understanding is that we want to protect people who update without
doing any testing (or recompiling).
Personally I agree with you, our stance on binary compatibility is
entirely too dogmatic and leads to stagnant outdated codebases.
Hen
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by sebb <se...@gmail.com>.
On 18 April 2011 21:03, Daniel F. Savarese <df...@savarese.org> wrote:
>
> In message <BA...@mail.gmail.com>, sebb writes:
>>If binary compat. is to be broken, then it needs to be done once, and
>>done properly so it does not have to be done again. That's not
>>something I personally have any inclination to tackle at present, so
>>I'm trying to ensure binary compat. whilst fixing as many of the bugs
>>as possible.
>
> Okay, fine. I disagree with the level of importance you're placing on
> binary compatibility as it places extreme limits on the ability of a code
> base to evolve for the better over time.
I agree it limits possible changes, but the limitations may not be as
bad as you imply.
For example it was possible to rewrite NNTP to use long instead of int
and still retain binary compat.
Breaking binary compat is very disruptive for downstream users; for
many (most?) Commons components it should be considered equivalent to
releasing a brand new component.
> Given that I've long advocated
> a Commons Net rewrite, I can buy into the extrapolated argument that if
> we're going to redesign Commons Net, let's do it properly from the
> ground up.
+1
> Since now is obviously not the right time to do that (as it
> would greatly delay a new release), I won't stir up the pot any further.
> However, if we're going to continue to live with warts and make ad-hoc
> workarounds in the interest of preserving binary compatibility, can we
> agree to not make any changes that break run-time compatibility (i.e.,
> changes like POP3.setState, which as far as I know was the only such
> change) except in the case of actual bug fixes or functionality
> enhancements?
Yes.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by sebb <se...@gmail.com>.
On 15 April 2011 20:34, Daniel F. Savarese <df...@savarese.org> wrote:
>
> In message <-2...@unknownmsgid>, Gary Gregory writes:
>>If your are going to break binary compatibility then a major release
>>is the time to do it. Is there any question that the design is wrong?
>
> I got the impression the change was made the way it was solely to work
> around binary compatibility issues (hence the provocative thread subject),
> not because it was believed to be the optimal approach. From that
> perspective, it's not "wrong." None of this stuff is ever really right
> or wrong; it just involves a different set of trade-offs. Since the
> Commons Net class structure is one of using classes primarily as modules
> containing related code for reuse (i.e., instantiable namespaces), not
> one of using classes for polymorphic generic programming, I think it best
> for maintenance and code understanding purposes to create a new module/class
> isolating common code for "protocol command clients" instead of placing it
> inside of the more general SocketClient. My real preference would be to use
> delegation, but Java doesn't have a way to automatically delegate to a
> member and manual delegation results in the code duplication that
> motivated the refactoring.
>
> If we can break binary compatibility, since this is a major release,
> this would be a good time to do a thorough code review. I know sebb's
> been doing a lot of that, but the more eyes the better.
Of course we *can* break binary compatibility, but for a component
like Net which is fairly low-level, IMO we should only do so if it's
really necessary, because of the additional work that it causes all
downstream users.
I originally thought it was going to be necessary to break binary
compat. to fix NNTP, but it turned out that it was not, so I really
don't want to break it for a code refactoring. I'd rather revert to
duplicating the code in all the classes that need it, though in the
general scheme of things I don't think the work-round is unreasonable.
If there is a better way of doing the refactoring without breaking
binary compat. then let's do that.
If anyone wants to completely rewrite Net to tidy it up, fine, it can
be released as a completely new product (which is effectively what
breaking binary compatibility means for the end-user).
If binary compat. is to be broken, then it needs to be done once, and
done properly so it does not have to be done again. That's not
something I personally have any inclination to tackle at present, so
I'm trying to ensure binary compat. whilst fixing as many of the bugs
as possible.
> daniel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [net] binary compatibility be damned
Posted by Gary Gregory <ga...@gmail.com>.
If your are going to break binary compatibility then a major release
is the time to do it. Is there any question that the design is wrong?
Gary
On Apr 15, 2011, at 10:49, "Daniel F. Savarese" <df...@savarese.org> wrote:
>
> Prior to the 3.0 release, I'm trying to review recent code changes and
> test the code in what little spare time I have available. I noticed that
> ProtocolCommandSupport __commandSupport was moved into SocketClient.
> I disagree with this change. SocketClient isn't meant to serve only
> Commons Net classes, nor is it meant only for implementing clients for
> IETF protocols; and only a limited number of clients actually need
> to use ProtocolCommandSupport. Having a private member variable that is
> initially null that must be initialized outside of the base class via calling
> createCommandSupport to initialize is fragile. That's what constructors
> are for. Even though Java doesn't have destructors, avoiding initialization
> protocols and using RAII is still a good rule of thumb for resource creation.
>
> A more robust and flexible separation of concerns would place the
> ProtocolCommandSupport member in a ProtocolClient abstract class that
> subclasses SocketClient and initializes __commandSupport (which should
> be protected, not private, obviating the need for getCommandSupport())
> in its constructor. Then the protocol clients that require
> ProtocolCommandSupport can be changed to subclass ProtocolCommandSupport.
> That won't break compilation of any user code, but breaks binary compatibility.
> Emphasizing binary compatibility at the expense of design doesn't make sense
> to me. Commons Net is enough of a Rube-Goldberg machine as it is.
>
> Is there some overriding reason why binary compatibility absolutely must
> be maintained or may I open an issue and make the above change?
>
> daniel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org