From Academic Kids

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. It, in turn, was influenced by Simula-67 and Sketchpad. Many software development ideas of the 1980s (Model-View-Controller, Class-Responsibility-Collaboration card) and 1990s came from the Smalltalk community, such as software design patterns, Extreme Programming and refactoring. Among Smalltalkers is Ward Cunningham, the inventor of the WikiWiki concept.



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

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 and run by a virtual machine (VM), 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;

and a few syntactic constructs for declaring literal objects and temporary variables.

The following code example for finding the vowels in a string illustrates Smalltalk's style. ( | characters declare variables, : declares parameters, [ and ] designate blocks):

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

Collection>>select: aBlock
| newCollection |
newCollection := self species new.
self do: [:each | 
    (aBlock value: each) 
        ifTrue: [newCollection add: each]].

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 researchers led by Alan Kay at XEROX Palo Alto Research Center; Alan Kay designed the system, which Dan Ingalls implemented. 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 metaclasses, something which helps keep the "everything is an 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 (HP, Apple Computer, Tektronix, and DEC) and universities (UC Berkeley) for "peer review" and implementation on their platforms. 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 an open source implementation 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.

Today, Smalltalk remains a niche language that has largely been pushed out by Java. IBM has indicated that they will stop supporting Smalltalk in the near future. Yet, some smaller companies continue to sell Smalltalk environments. Squeak has a relatively active community of developers. GNU Smalltalk ( is a free (GPL) implementation of Smalltalk from the GNU project. More recently, Ruby has reimplemented many of Smalltalk's ideas, providing a more traditional syntax, an extensive standard library, while also borrowing concepts from other languages such as Perl and Python.

Hello World

Trivial example

Transcript show: 'Hello, world!'

This example highlights two aspects of Smalltalk.

First, it is a "message send." Smalltalk does most of its computation by sending messages to objects. In this case, the message is "show: 'Hello, world!'", and the message gets sent to "Transcript". Transcript's "show:" method will be invoked to handle this message, which will look at its argument (the string 'Hello, world!') and display that argument on the transcript. (Note that if you try this example, you need to have a Transcript window open in order to see the results.)

Second, it illustrates the basic syntax of message-sending in Smalltalk: RECEIVER SPACE MESSAGE. There is no period after the receiver, unlike in C++'s popular OO syntax, and there are no parentheses around the arguments included in the message.

Object-oriented example

Class definition

Object subclass: #MessagePublisher
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: ''
    category: 'Smalltalk Examples'

This is a simple stock definition with the class name and category filled in. Often, the environment will write most of it for you.

Method definition

    Transcript show: 'Hello, world!'

This defines a method called "publish". The body of the method is the same code as shown in the trivial example.


MessagePublisher new publish

This creates an instance of MessagePublisher ("MessagePublisher new"), then sends the "publish" message to it, that is, it invokes the "publish" method.


See also

External links

Template:Major programming languages smallde:Smalltalk (Programmiersprache) es:Smalltalk fr:Smalltalk it:Smalltalk nl:Programmeertaal Smalltalk ja:Smalltalk pl:Smalltalk ru:Smalltalk sk:Smalltalk fi:Smalltalk sv:Smalltalk uk:Smalltalk zh:Smalltalk


Academic Kids Menu

  • Art and Cultures
    • Art (
    • Architecture (
    • Cultures (
    • Music (
    • Musical Instruments (
  • Biographies (
  • Clipart (
  • Geography (
    • Countries of the World (
    • Maps (
    • Flags (
    • Continents (
  • History (
    • Ancient Civilizations (
    • Industrial Revolution (
    • Middle Ages (
    • Prehistory (
    • Renaissance (
    • Timelines (
    • United States (
    • Wars (
    • World History (
  • Human Body (
  • Mathematics (
  • Reference (
  • Science (
    • Animals (
    • Aviation (
    • Dinosaurs (
    • Earth (
    • Inventions (
    • Physical Science (
    • Plants (
    • Scientists (
  • Social Studies (
    • Anthropology (
    • Economics (
    • Government (
    • Religion (
    • Holidays (
  • Space and Astronomy
    • Solar System (
    • Planets (
  • Sports (
  • Timelines (
  • Weather (
  • US States (


  • Home Page (
  • Contact Us (

  • Clip Art (
Personal tools