Interfaces

Ralph E. Johnson johnson at cs.uiuc.edu
Thu Feb 5 14:54:33 UTC 1998


At 11:20 PM 2/4/98, Matthijs van Kempen wrote:
>Anyway the real reason I started asking about interfaces is that I 
>like the notion of components. I wonder if we could do something like 
>this in Squeak.

Interfaces are not the same thing as components.

First, "component" is not really a technical term.  It is more of a marketing
term.  A component is something that is ready to use, that can be acquired
and plugged in to solve a problem.  Interfaces are a technical device to help
realize components.  However, there are many different definitions of interfaces.
A COM interface is different from a Java interface which is different from a
CORBA or Eiffel interface.  Using interfaces does not necessarily give you
components, and you can make a component without (explicit) interfaces.  
However, I agree that interfaces are a good thing and that it would be good
for Smalltalk to have a more well-defined notion of interface.  I just don't
agree that it will solve as many problems as you seem to think it will.

You can add COM interfaces to Smalltalk, and several of the vendors have
done it so that you can use and implement COM objects in Smalltalk.  But
these interfaces do not make programming in Smalltalk easier.  They just
make it easy to communicate with the COM world.

The reason that COM interfaces are easy to add to Smalltalk is that they
are a run-time concept.  An interface is a handle to an object, and you
can store them in a variable.  Smalltalk is good at modeling run-time values.

Java and Eiffel interfaces are compile-time concepts.  They are part of
type-checking, and Smalltalk has no compile-time type-checking.  (Actually,
Eiffel's is part compile-time and part run-time, because assertion-checking
usually happens at run-time.)  So, it is harder to add those kinds of 
interfaces to Smalltalk.  However, it is possible.  I've built a type-checker
for Smalltalk, though I didn't think it was usable enough to be useful.

At 10:51 PM 2/4/98, Serg Koren wrote:
>>Otherwise any component can be replaced disregarding the behavior, so
>>long as the signature is satisfied.
>
>Yup this is what CORBA IDL is meant to do...

And C++ and Java type-checking.  But C++ type-checking is a pain in the
neck, and CORBA IDL is even weaker.  There is a big difference between
"meant to do" and "does".

-Ralph





More information about the Squeak-dev mailing list