[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Java interface natural history was RE: "static" declaration

> While I agree that interfaces are important in Java, i miss mixins and
> multiple inheritance as in Common Lisp, for example.  In Java you need to
> implement the interface over and over.

Oh definitely.  Not having support for any implementation reuse mechanism
other than single inheritance is a harsh restriction, in a system that
supports multiple interfaces on classes, and I'm sure it inhibits use of
interfaces in Java.  I didn't mean to imply that Java was unassailable in
this respect, but if you don't look to closely at the implemenation side of
things ;) it's an example of the interface-oriented approach having
succeeded in practice.

Many people unfamiliar with Java don't seem to be aware of the approach, or
its possibilities.  Even if they're familiar with it in dynamically-typed
systems, they may not have seen it in action with static typing.

As for reuse of interface implementations, you seem to have some Lisp code
to read Java classes - can't you use that to generate Java classes, too??

> Your message made me curious about how interfaces are actually
> used in Java.
> Here's what i found by scanning JDK1.4's rt.jar:
> Other jars could have a higher interface ratio, and certainly user code
> might have more concrete classes that implement those interfaces.

I suspect that some of the third-party libraries out there might have
heavier use of interfaces, and I also have the impression that newer JDK
code uses them more heavily than was done in earlier code that's still
present in the JDK.  My experience is that in "modern" Java programming (as
opposed to the dark ages back at the dawn of time, around 1996), interfaces
are being used pretty commonly and appropriately.