On 5 February 2012 18:29, Thomas Neidhart <thomas.neidh...@gmail.com> wrote: > On 02/03/2012 10:33 PM, Gilles Sadowski wrote: >> On Fri, Feb 03, 2012 at 08:33:44PM +0100, Thomas Neidhart wrote: >>> Hi, >>> >>> I have been working on the exceptions in the stat.inference package and >>> have seen that all classes in this package follow the same scheme: >>> >>> - Interface for a statistical test >>> - Implementation of this single interface >>> >>> e.g. >>> >>> ChiSquareTest >>> ChiSquareTestImpl >>> >>> There was some effort in other packages, e.g. distribution to merge such >>> constructs, and was wondering if not the same should apply here. >>> >>> I do not see an immediate benefit of having separate interface and >>> implementation for a single Test, especially as there is no base Test >>> interface. > > Actually I would even go further, and change all the provided methods to > static functions as this is the way they are actually used via the > utility class TestUtils (see also the tutorial about Statistics). > > TestUtils provides utility methods for each test. Therefore it > instantiates each Test once and calls the corresponding methods. As all > these tests are stateless, i.e. they do not store any data, there is no > real need to do it that way.
AFAIK, the only disadvantage of static methods is that they cannot be overridden by a subclass. But if this is not required, then static methods are slightly easier to use. > Thomas > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org