- SmallInterfaces Squeak Port -

What's new?

(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!

Introduction

What is SmallInterfaces?

'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.

Why an interface is such a good concept?

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.

What features does SmallInterfaces have?

SmallInterfaces Squeak version 2.0.0 main features are:

+

GETTING THE SYSTEM

Download now!

System Requirements:

Squeak 2.8-3.4

Release Dates and Changes:

License:

SmallInterfaces is basically under the original author's licence.
GUIs for Squeak are developed from scratch and under the public domain.(without any warranty).

Installation and run:

For Squeak 3.4

  1. InstallSmallInterfaces Squeak 2.0.0a SAR from Package Loader.

For Squeak 2.8

  1. Download the SmallInterfacesSqueak2.0.0.zip
  2. Extract the archive. It will create SmallInterfaces2.0.0 folder.
  3. Put the folder in Squeak root. 
  4. Open a FileList and file-in install.st in the folder.
  5. In Workspace, just do it - "SIInterfaceFinder open".

Note:

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).

See the screenshot:

  1. SIInterfaceFinder

What's the next?

My next plans are:

TUTORIAL

What shall I do with interfaces?

To create a new interface:

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.

To extend an interface:

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 the interfaces:

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.

To declare implementing interfaces:

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.

To create skeleton methods:

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.

OTHERS

Requests to Squeak Team!

  1. Squeak should support the notion of interface.

  2. Squeak should support name spaces in more user-friendly and robust way... I had to use prefixes in GUI and Util classes.

Again thanks for the most innovative environment in the planet!

Suggestions?

Any feedback is appreciated.

Masashi Umezawa

also see the other Squeak projects