Smalltalk

Source: https://www.wikiwand.com/en/Smalltalk (via https://en.wikipedia.org/wiki/Smalltalk)


Smalltalk is a purely object-oriented programming language originally created in the 1970s for educational use, specifically for constructionist learning, but later found use in business.

The language emerged from research at Xerox PARC's Learning Research Group, with key contributors including Alan Kay, Dan Ingalls, and Adele Goldberg. Development began around 1969, with public release occurring in 1972.

Historical Development

Smalltalk evolved through several versions:

The first interpreter was implemented by Dan Ingalls in approximately 700 lines of BASIC in October 1972 for the Data General Nova computer. Smalltalk-72 was subsequently ported to the Xerox Alto in April 1973.

Core Concepts

Object-Oriented Foundation

A Smalltalk object can do exactly three things:

The language treats all values as objects. "Everything is an object" more accurately means "all values are objects," since variables themselves are not objects.

Messaging System

Alan Kay emphasized that "The big idea is 'messaging'—that is what the kernel of Smalltalk/Squeak is all about."

Message sending represents the fundamental operation in Smalltalk. The language uses three message types:

Reflection

Smalltalk-80 provides both structural and computational reflection. The system allows developers to "walk through, examine, and modify code in the running system" at runtime. The compiler itself is written in Smalltalk and can be extended during program execution.

Smalltalk-80 is a totally reflective system — the classes and methods that define the system are also objects and fully part of the system that they help define.

Syntax

The language features minimal syntax. There are only five reserved pseudo-variables: true, false, nil, self, and super.

Basic Examples

Hello World:

Transcript show: 'Hello, world!'.

Variable Declaration:

| index vowels |

Assignment:

vowels := 'aeiou'

Message Sending:

42 factorial

Blocks (Anonymous Functions):

[:x | x + 1]

Control Structures

Control structures are implemented as message sends rather than language keywords:

result := a > b
    ifTrue:[ 'greater' ]
    ifFalse:[ 'less or equal' ]

Development Environment

Smalltalk pioneered the Integrated Development Environment (IDE) concept. Key tools include:

Image-Based Persistence

Smalltalk systems store entire program state—both code and data—in an "image" file. This approach allows restoration of the system to a previous state without losing development information like undo history or cursor position.

Influence

Smalltalk is one of the most influential programming languages. Subsequent object-oriented languages including Flavors, CLOS, Objective-C, Java, Python, and Ruby were influenced by Smalltalk's design.

The language environments were often the first to develop what are now common object-oriented software design patterns, particularly the Model-View-Controller (MVC) pattern for user interface design.

Standards and Current Status

ANSI Smalltalk was ratified in 1998 as the standard language reference. Modern implementations include:

In 2017, Smalltalk took second place for "most loved programming language" in the Stack Overflow Developer Survey.

Key Characteristics

Live Coding: Smalltalk code can be modified while the system is running. Live coding and applying fixes "on-the-fly" is a dominant programming methodology for Smalltalk.

Pure Object-Orientation: There are no primitive types; even integers and booleans are objects responding to messages.

Dynamic Typing: Variables do not require type declarations, enabling flexible and concise code.

Accessibility: Everything in Smalltalk-80, unless customised to avoid the possibility, is available for modification from within a running program.