Smalltalk Programming Language

  • In the news

  • Ruby/Tk Primer: Creating a cron GUI Interface with Ruby/Tk
    MacdevCenter -
    ... Another feature shared by Smalltalk and Ruby (and other languages, such as Java) is ... Regardless of whether you refer to Ruby as a programming language or as a ...
  • A PC Pioneer Decries the State of Computing
    Fortune (subscription) -
    ... primarily designed to help children and change the way learning is done." It is a version of the Smalltalk object-oriented programming language Kay invented ...
  • Java Releases Ramp Up Productivity
    eWeek -
    Advanced interactive programming environments, such as LISP machines or Smalltalk workstations, were admired during ... It takes a language like Java with ...
  • Higher-Order Messages in Cocoa
    MacdevCenter -
    ... At the end of a year of programming, you'll have ... Removing for or while from the language would be ... In languages like Smalltalk, HOM is implemented with lexical ...

Smalltalk is a dynamically typed object oriented programming language designed at Xerox PARC by Alan Kay, Dan Ingalls, Ted Kaehler, Adele Goldberg, and others during the 1970s. The language was generally released as Smalltalk-80 and has been widely used since. Smalltalk is in continuing active development, and has gathered a loyal community of users around it.

Smalltalk has been a great influence on the development of many other computer languages, including: Objective-C, Actor, Java and Ruby (the latter one to such an extent that many Smalltalkers consider Ruby to be Smalltalk with a different syntax). Many software development ideas of the 1990s came from the Smalltalk community, such as design patterns (as applied to software), Extreme Programming and refactoring. Among Smalltalkers is Ward Cunningham, the inventor of the WikiWiki concept.

1 Smalltalk's big ideas

2 History

3 Implementations

4 Tutorials

5 External links

Table of contents

Smalltalk's big ideas

Smalltalk's big ideas include:

  • "Everything is an object." Strings, integers, booleans, class definitions, blocks of code, stack frames, memory are all represented as objects. Execution consists of sending messages between objects. Any message can be sent to any object; the receiver object determines whether this message is approprate and what to do to process it.
  • Everything is available for modification. If you want to change the IDE, you can do it-- in a running system, without stopping to recompile and restart. If you want a new control construct in the language, you can add it. In some implementations, you can change even the syntax of the language, or the way the garbage collection works.
  • Types are dynamic -- this means that you don't have to define types in the code which makes the language much more concise. (As explained above, it is the receiver object rather than the compiler that decides whether an operation is appropriate).
  • Model-view-controller (MVC) pattern for structuring user interfaces.
  • Dynamic translation: modern commercial virtual machines compile bytecodes to the native machine code for fast execution, a technique pioneered by Smalltalk-80 from ParcPlace Systems in mid-1980s. This idea was adopted by Java some ten years later and named "Just-in-time compilation", or JIT.
Smalltalk also made use of other advanced ideas:

  • Garbage collection is built in and invisible to the developer.
  • Smalltalk programs are usually compiled to bytecodes, run by a virtual machine, which allows them to be executable on any hardware platform for which a VM is available.
One surprising feature of Smalltalk is that the traditional progamming constructs: if-then-else, for, while, etc. are not built into the language. All of these things are implemented using objects. For example, decisions are made by sending an ifTrue: message to a Boolean object, and passing a fragment of code to execute if the Boolean is True. There are only three built-in executable constructs:
  • sending a message to an object;
  • assigning an object to a variable;
  • returning an object from a method;
The following code example for finding the vowels in a string illustrates Smalltalk's style. ( | characters declare variables, : declares parameters, and think of [ and ] as { and } curly braces for the moment): | aString vowels | aString := 'This is a string'. vowels := aString select: [:aCharacter | aCharacter isVowel]. In the last line, the string is sent a select: message with the code block following as an argument. Here's the code in the superclass Collection that does the work: | newCollection | newCollection := self species new. self do: [:each | (aBlock value: each) ifTrue: [newCollection add: each]]. ^newCollection It responds to the message by iterating through its members (this is the do: method) evaluating aBlock code once for each character; aBlock (aCharacter isVowel) when evaluated creates a boolean, which is then sent ifTrue:. If the boolean is true, the character is added to a string to be returned. Because select is defined in the abstract class Collection, we can also use it like this: | rectangles aPoint| rectangles := OrderedCollection with: (Rectangle left: 0 right: 10 top: 100 bottom: 200) with: (Rectangle left: 10 right: 10 top: 110 bottom: 210). aPoint := Point x: 20 y: 20. collisions := rectangles select: [:aRect | aRect containsPoint: aPoint].


Smalltalk was invented by a group of researches led by Alan Kay at XEROX Palo Alto Research Center. The first implementation, known as Smalltalk-71, was created in a few mornings on a bet that a programming language based on the idea of message passing inspired by Simula could be implemented in "a page of code". A later version actually used for research work is now known as Smalltalk-72. Its syntax and execution model were very different from modern Smalltalk, so much so that it could be considered a different language.

After significant revisions which froze some aspects of executional semantics to gain performance, the version known as Smalltalk-76 was created. This version added inheritance, featured syntax much closer to Smalltalk-80, and had a development environment featuring most of the tools now familiar to Smalltalkers.

Smalltalk-80 added meta-classes, something which helps keep the "everything is a object" statement true by associating properties and behavior with individual classes (for example, to support different ways of creating instances). Smalltalk-80 was the first version made available outside of PARC, first as Smalltalk-80 Version 1, given to a small number of companies and universities for "peer review". Later (in 1983) a general availability implementation, known as Smalltalk-80 Version 2, was released as an image (platform-independent file with object definitions) and a virtual machine specification.

Two of the currently popular Smalltalk implementations are descendants of those original Smalltalk-80 images. Squeak is derived from Smalltalk-80 Version 1 by way of Apple Smalltalk. VisualWorks is derived from Smalltalk-80 version 2 by way of Smalltalk-80 2.5 and ObjectWorks (both products of ParcPlace Systems, XEROX PARC spin-off company formed to bring Smalltalk to the market). As an interesting link between generations, here is a screenshot of Smalltalk-80 version 2 image running on Hobbes, a Smalltalk-80 VM implemented in VisualWorks.



  • There are WikiWiki implemented in Squeak Smalltalk (swiki) and VisualWorks (WikiWorks). You can download Swiki from WikiWorks is included in VisualWorks distribution (available for free for non-commercial use, see the link above).

External links