Encyclopedia  |   World Factbook  |   World Flags  |   Reference Tables  |   List of Lists     
   Academic Disciplines  |   Historical Timeline  |   Themed Timelines  |   Biographies  |   How-Tos     
Your Ad Here
Sponsor by The Tattoo Collection


Smalltalk programming language
Main Page | See live article | Alphabetical index

Smalltalk programming language

        

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.

Table of contents
1 Smalltalk's big ideas
2 History
3 Implementations
4 Tutorials
5 External links

Smalltalk's big ideas

Smalltalk's big ideas include:

Smalltalk also made use of other advanced ideas:

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

History

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.

Implementations

Tutorials

External links



Programming languages
Ada | AWK | BASIC| C | C++ | C# | COBOL | ColdFusion | Common Lisp | Delphi | Fortran | IDL | Java | JavaScript | Lisp | Perl | PHP | Prolog | Pascal | Python | SAS | SQL | Visual Basic | More programming languages
Edit this template