Teach Time Encyclopedia - Learn About Our World
Home Page
Teach Time
Featured Topics

United States
by state

CITYology

Academic Disciplines

Historical Timelines

Themed Timelines

Calendars

Reference Tables

Biographies

How-tos



Monday, October 13, 2008

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.

In spite of its 20-year history, it is widely believed that the overall programming experience and productivity of Smalltalk is still unsurpassed by other development environments. Smalltalk is in continuing active development, and has gathered a loyal community of users around it.

Smalltalk has been had a great influence on the development of many other computer languages, including: Objective-C, Actor, Java and Ruby. 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.

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.
  • 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.
  • Garbage collection is built in and invisible to the developer.
  • Smalltalk programs are usually compiled to bytecodes, run by a virtual machine.
  • 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.

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

Table of contents
1 External Links

External Links

Implementations

Tutorials



Internet Hotel Solutions

Site Sponsors
AC Units
Baltimore Harbor
Boot Camp Grads
Bra Size
Burkittsville
College Hotels
Digital Harbor
Free Cell Phones
Golden Hare Travel
Golf Vacations
Golf Courses
Gourmet
Hair Styles
Hippodrome
iWoman
Lesson Plans
Maryland Hotels
MD Genealogy
Minor League Stuff
Motel Site
Ocean City
OC Real Estate
Old Agers
Office Supplies
Orlando
Pet Friendly Hotel
Room Prices
Savannah, GA
Ski Vacations
South Baltimore
Student Teaching
Travel Sources
University Hotels
Visit Military Bases
Washington, DC

Brought to you by NoChildLeftBehind.com and the Beaches and Towns Network, LLC.