Final defenders

Yuval Shavit yshavit at akiban.com
Tue Aug 7 14:09:32 PDT 2012


I would vote class, so that it can be given a private constructor.

On Tue, Aug 7, 2012 at 5:03 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:

> Another question would be, for a namespace like java.lang.Math, that
> does nothing but host some static methods, should it be a class or an
> interface?
>
> Zhong Yu
>
> On Tue, Aug 7, 2012 at 1:16 PM, Daniel Latrémolière
> <daniel.latremoliere at gmail.com> wrote:
> >
> >> Hi,
> >>
> >> these methods should be in a class if they are useful. E.g. in
> >> java.util.Collections.
> >>
> >> Z.
> > By being in List interface, they are easier to find. In an external
> > class, they have a very small value comparing to current constructors.
> > Static methods from classes like Collections, Arrays are not useful for
> > beginners because they are impossible to find in a very big API like
> Java).
> >
> > But, if you know that all lifecycle (factory for creation, change of
> > content, etc.) of a List is managed by List interface, you know exactly
> > where to find the solution of your problem. You can even publish a
> > subset of javadocs of Java without implementing classes like ArrayList,
> > LinkedList, etc. which will be much more clear for learning Java and
> > attracting new users.
> >
> > A defender method in interface can too be a method in Collections class
> > (even allowing specialized implementation with a service to be
> > implemented), but this is always more difficult to find and it give
> > globally a very complex API.
> >
> > Daniel.
> >
>
>


More information about the lambda-dev mailing list