Smalltalk is a dynamically typed message passing language. It is unique due to syntax and object oriented features. It is generally interpreted but is often compiled to a bytecode first.

Why would I learn this language?

Smalltalk is a powerful environment for exploring many different elements of computer programming, including rich media such as audio and user interfaces. Smalltalk code is generally concise and easily readable due to its message based syntax.

Smalltalk provides an integrated code browser and debugger which are incredibly powerful and easy to use. This makes Smalltalk a highly productive environment where code can be modified and fixed in the running application.

Starting Points

Pharo Open Source Smalltalk
Pharo is a clean, innovative, open-source Smalltalk environment available for many platforms.
Squeakland: home of squeak etoys
Etoys is an educational tool for teaching children programming with examples from other academic fields.
Introduction to Squeak
A set of resources for learning about Smalltalk programming in the Squeak environment.

Example Code

Here is an example of the Fizz Buzz problem:

1 to: 100 do: [:n|
	((n \\ 5 == 0 ) & (n \\ 3 == 0)) ifTrue: [
		'FizzBuzz' printNl.
	] ifFalse: [
		(n \\ 5 == 0) ifTrue: [
			'Buzz' printNl.
		] ifFalse: [
			(n \\ 3 == 0) ifTrue: [
				'Fizz' printNl.
			] ifFalse: [
				n printNl.

Here is an example of the 100 doors problem:

doors := [ :count |
	"Initialize the array of doors to 0 (closed)"
	a := Array new: count withAll: false.

	"Process the doors"
	a withIndexDo: [ :each :index |
		index to: (a size) by: index do: [:this |
			a at: this put: (a at: this) not

	"Print out the results"
	1 to: count do:
		[ :n |
			show: 'Door #', n, ' is ';
			show: ((doors at: door) ifTrue: [#open] ifFalse: [#closed]);
			show: '.';

doors value: 100.

Further Reading

comments powered by Disqus