- SmallInterfaces Squeak Port -
(2002/12/29)
Version 2.0.0a. Now available in SAR. Minor GUI improvements. It runs on Squeak 3.4!
An article of SmallInterfaces - 'Adding Dynamic Interfaces to Smalltalk' in JOT
(2001/01/23)
I found again the current Squeak2.8 *needs* my old patch (dirty-fix).
I rewrote again 'install.st'. Sorry for the wrong assumption.
(2001/01/08)
I found that Squeak2.8 no longer needs my patch for 2.8alpha/beta.
I rewrote install script. Please do not install the "dirty-fix"
patch.
(2000/06/02)
SmallInterfaces 2.0 now runs on Squeak2.8(alpha/beta).
I added patches for Squeak2.8. Enjoy!
(2000/05/22)
SmallInterfaces 2.0 Squeak port is now available!
(2000/05/13)
Original SmallInterfaces 2.0 is just released today. Squeak port will be
available in a few weeks. (Sorry Squeakers!)
This documentation is based on version
1.5 So its contents is temporarily out
of date. See the original site for new SmallInterfaces features.
(2000/04/03)
Current version of SmallInterfaces(1.5) is
not file-in-able in Squeak 2.7(or higher)
I'm now porting a new version(2.0). Just
wait!
'SmallInterfaces' brings you long-awaited
'interface' in Smalltalk.
The extension is originally developed by
Benny Sadeh in VisualWorks NC. (see the SmallInterfaces original web site)
I ported this interesting extension to Squeak.
Smalltalk is a dynamically typed language.
It has no declarations of types in variables.
This feature enables us to develop applications
more rapid and flexible way. It also encourages
the reuse of objects in Smalltalk. (by implicit
polymorphism).
However, we sometimes encounter the situation
that we would like to limit the type. Suppose
the GOF visitor pattern, the visited object
should understand the set of callback methods
so that visitor client can safely delegate
its requests. Of course, it is possible
to use isMemberOf:/isKindOf: messages to the visited object for type
checking. Although it works, we must admit
that it is only a workaround. The isMemberOf/isKindOf: method is based on a class hierarchy, but
what we really like to specify is the set
of messages the object should respond to.
The "SmallInterfaces" introduces
interface in Smalltalk. Interface specifies which
messages an object will execute (not *how*
the object is going to work). It will lead
to a better Responsibility Driven Design.
+
Squeak 2.8-3.4
SmallInterfaces is basically under the original
author's licence.
GUIs for Squeak are developed from scratch
and under the public domain.(without any
warranty).
For Squeak 3.4
For Squeak 2.8
Filing-in SmallInterfaces2.0.0a will overwrite system classes.
In most situation, it is harmless. If you
are anxious about conflicts, please
check SmallInterfaces Squeak SysChanges.cs (unzip SAR).
For example, if we would like to create a new interface, IExtensibleCollection, that having all methods defined in ANSI <extensibleCollection> protocol, just "do it" as follows:
Interface newNamed: #IExtensibleCollection withSelectors: #(#add: #addAll: #remove: #remove:ifAbsent: #removeAll:).
In default, a new interface is created in 'Interface' class category. You can see IExtensibleCollection is up on there.
Suppose that we need an IBag interface which extends IExtensibleCollection and adds a new method, #add:withOccurences:, "do it" as follows:
Interface newNamed: #IBag extending: 'IExtensibleCollection' additionalSelectors: #(add:withOccurrences:)
Again, you will see a newly created IBag in 'Interface' class category.
To check if the Bag class understands IBag interface, you can do as follows:
Bag understands: IBag
It returns true. #understands: will lookup the method implementations toward super classes.
Above is a dynamic checking of implementing interfaces. We can also declare the interfaces that a class should implement.
Suppose you create a new Bag implementation, MyBag. In MyBag, you should implement a requiredInterfaces class method as follows:
requiredInterfaces ^Array with: IBag
Some tool (like a compiler) can check if MyBag actually implements IBag interface:
MyBag understandsRequiredInterfaces.
SmallInterfaces also accelerates development. You can create skeleton methods from an existing interface.
MyBag implement: IBag
It will create all skeleton methods in MyBag needed to support IBag. Now 'MyBag understandsRequiredInterfaces' returns true.
Squeak should support the notion of interface.
Again thanks for the most innovative environment in the planet!
Any feedback is appreciated.
also see the other Squeak projects