Final defenders

Daniel Latrémolière daniel.latremoliere at
Wed Aug 8 02:09:05 PDT 2012

> Hi Daniel,
> unfortunately, these arguments are going against a basic principal in OO
> programming. You asked so that List knows about the classes that
> implements it.
> Z.
I don't think it is against my only real principles of OO programming: 
abstraction and simplicity!

I have nothing against an implementation of these static methods, using 
a service to allow external configuration of the real classes 
implementing List and instantiated by these static methods. It will 
possibly solve your problem of List knowing some default implementation 
classes if you really dislike this, but I don't think it is a real problem.

You will always have a class knowing one subclass as default 
implementation, in all factories (and there is numerous in Java), by 
|public static SAXParserFactory newInstance() {
   try {
     return (SAXParserFactory) FactoryFinder.find(
       /* The default property name according to the JAXP spec */
       /* The fallback implementation class name */
   } catch (FactoryFinder.ConfigurationError e) {
     throw new FactoryConfigurationError(e.getException(), e.getMessage());

More information about the lambda-dev mailing list