Return-Path: Delivered-To: apmail-commons-dev-archive@www.apache.org Received: (qmail 17428 invoked from network); 16 Nov 2010 23:44:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Nov 2010 23:44:41 -0000 Received: (qmail 5294 invoked by uid 500); 16 Nov 2010 23:45:12 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 5188 invoked by uid 500); 16 Nov 2010 23:45:12 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 5180 invoked by uid 99); 16 Nov 2010 23:45:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Nov 2010 23:45:12 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sebbaz@gmail.com designates 209.85.216.43 as permitted sender) Received: from [209.85.216.43] (HELO mail-qw0-f43.google.com) (209.85.216.43) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Nov 2010 23:45:06 +0000 Received: by qwk3 with SMTP id 3so1328203qwk.30 for ; Tue, 16 Nov 2010 15:44:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=yNVwWe8nEPHpkZdKDdfWP2oMI/RYKhj2QFIP4CrLm5w=; b=WEB666m7vTLz8KVEZBaaLrZcPQPokCikH3+N22us1IyONNJp2/RqROXUuPdSoc8VGm ItaQ6lGS76dDlIYq9ZJlI3hmKgb3eJQlaugVi4IUk+BLnytqkgIFbu0o7d0Bia152iNP 48s7vljTT2b1MeNdkwPDlj2QzBJ8uhMzepgs8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=wxGqMmxwagzdDNAgyovV/kW1X3XeElOlSWz45A0h8MeyfsFdJE8vSc/JtJSMqT79Yw hCRZqHEFlFeGBIc6HRKVysOabk6wUGiLLMmxzL4oxM3lySp2GH9xl3Uv6A2xSp0sFZPP 2rsMlpaVo/7ky56UzCCG/F5VaThY02K7XEPw8= MIME-Version: 1.0 Received: by 10.229.82.85 with SMTP id a21mr6896766qcl.71.1289951084859; Tue, 16 Nov 2010 15:44:44 -0800 (PST) Received: by 10.229.72.94 with HTTP; Tue, 16 Nov 2010 15:44:44 -0800 (PST) In-Reply-To: <20101116231944.GL10411@dusk.harfang.homelinux.org> References: <4CE2EEF4.2030204@free.fr> <20101116231944.GL10411@dusk.harfang.homelinux.org> Date: Tue, 16 Nov 2010 23:44:44 +0000 Message-ID: Subject: Re: [math] preparing smooth interface upgrade for users From: sebb To: Commons Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On 16 November 2010 23:19, Gilles Sadowski w= rote: > Hello. > >> As we are changing a lot of things in 3.0, it would be interesting to >> have 2.2 help users smoothly adapt their code. Many exceptions have/will >> be changed and some of them are used in public interfaces users have to >> implement. Typical examples are FirstOrderDifferentialEquations and the >> associated DerivativeException, or UnivariateRealFunction and >> FunctionEvaluationException. >> >> Discussion on MATH-425 lead to group these user-specific exception as >> one single unchecked exception: MathUserException. This choice has the >> additional advantage that when a user uses an ode solver inside an >> optimizer for example, the same exception can be used at both levels and >> an error condition occurring at very low level can be handled at top >> level without problem. >> >> In order to help users, I am going to use for 2.2 a transition scheme >> where the exceptions DerivativeException, FunctionEvaluationException >> and similar ones would all be deprecated and at the same time their base >> class would be changed to the new MathUserException. Then the user >> methods in the public interfaces would be declared to throw >> MathUserException. So we would change from the current design which is: >> >> public class DerivativeException extends MathException {...} >> >> public interface FirstOrderDifferentialEquations { >> =A0 public void computeDerivatives(...) throws DerivativeException; >> } >> >> to a new design which would be: >> >> public class MathUserException extends RuntimeException {...} >> >> @Deprecated >> public class DerivativeException extends MathUserException {...} >> >> public interface FirstOrderDifferentialEquations { >> =A0 public void computeDerivatives(...) throws MathUserException; >> } >> >> Then in 3.0 the deprecated exceptions would be removed (I think Gilles >> already did it). >> >> This is an interface change, but I think it is worth doing it and it >> does provide a sufficient level of compatibility. These interfaces are >> intended to be implemented by user, to implement their own business >> problems. Many already have implemented the interface in its 2.1 >> version, probably using a DerivativeException for their error handling. >> Since DerivativeException would still be there in 2.2 and it would >> extend MathUserException, these implementations would both continue to >> work in 2.2 and new users and new implementations could already use the >> new MathUSerExceptions. The only pain for existing implementations would >> be to see warnings about the deprecated exceptions. Users would have >> some time to adapt their code and use directly MathUserException, which >> provide at least everything DerivativeException did provide up to now. >> >> I guess CLIRR will complain and consider this an incompatible change. It >> is true from a caller perspective since now we should expect >> MathUserExceptions rather than only DerivativeExceptions. However, >> MathUSerException is unchecked and the callers for these interfaces are >> the commons-math methods, which we will adapt. These interfaces are not >> intened to be called by user code, they are intended so that user code >> can be called by our library. >> >> I think this transition is the smoother path for our users. Do you think >> this change is the way to go ? > > -0 +1 > > My first impression is that it is a lot of changes for 2.2 without any > benefit when users will switch to 3.0; they will still have to scan their > code for all the exceptions that will have disappeared. Won't the deprecations take care of that? > In 3.0 it will clear that they *have* to do it while, in 2.2, you would > have to explain to users that it's better that they do it but that it > will still work if they don't... And they will probably say: "If it ain't > broken, I won't fix it." ;-) However, deprecation warnings are a strong hint that failure is imminent, and they may wish to prepare for the change. > Regards, > Gilles > > --------------------------------------------------------------------- > 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