[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Curl, multiple inheritance, and interfaces (was Re: cheerful static typing)
Dan Weinreb wrote:
> in Java, it's
> impossible to ignore interfaces
>
> Well, I wouldn't describe Java with words that strong. You could
> imagine an alternative design in which every class must implement some
> interface; that would make it impossible to ignore interfaces. With
> Java, you can have classes that do inheritance, and that have abstract
> methods, without using Java interfaces.
You're right; interfaces are "impossible to ignore" in Java not because of
the language itself, but because of its libraries, which make heavy use of
interfaces. Still, I think the mere act of putting the keyword 'interface'
into the Java language did a lot to disseminate good program design
practices and thinking. It identifies interfaces as entities distinct from
classes, as opposed to relegating them to a kind of subordinate category of
classes - "classes without an implementation".
This class-bias affects the thinking of many of the users of such languages,
especially those who develop primarily or exclusively in a single language.
It commonly leads to code which over-emphasizes specific implementations and
under-emphasizes properly factored abstractions. Abstractions then tend to
be designed around the opportunities for implementation inheritance, which
is definitely the tail wagging the dog.
Of course, a language can't fix or prevent bad program designs, but it can
help get programmers thinking in good (or bad!) directions.
Anton