Re: The daily WTF: interface Addin?
Andreas Leitgeb wrote:
Eric Sosman <esosman@acm-dot-org.invalid> wrote:
No; aloha.kakuikanu wrote. Please be careful with
attributions.
public interface Addin
{
public void initialize();
}
There is lots of comments what the "contract" of this interface is
supposed to be. The real question is, however, if this interface is not
void on information content.
The contract is not limited to the interface definition!
The human-readable documentation of the interface is just
as important a part.
To extreme, an interface need not contain any method at all
(it's called a "marker interface" then). Still, deriving
from that interface can mean a lot depending on what the
documentation says about it.
examples (look them up in sun's javadoc):
java.lang.Cloneable
java.util.RandomAccess
The "information content" of this interface is that every
implementing class has a public method named `initialize' taking
no arguments and returning no value.
That's just the technical part. Rule of thumb: The smaller the
interface, the less important is the technical part compared to
the verbal part (the docu) :-)
The O.P. offered only the "technical part" for commentary,
mentioning but omitting the "lots of comments" in the original
code. His question (as I understood it) was whether the
"technical part" carried any information, irrespective of any
commentary. I said "yes." (Perhaps I should also have said
"... but not enough.")
--
Eric Sosman
esosman@acm-dot-org.invalid