Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
Like this article? We recommend

Smalltalk

Smalltalk is the archetypal object-oriented (OO) language. It was developed at Xerox PARC by a group including Alan Kay, who first coined the term object-oriented. The concept behind object-oriented programming is that you can simplify development of software if you split your general-purpose computer into a load of simple specialized computers (objects) that communicate by message-passing. This simplicity has been lost in a lot of later languages.

Smalltalk is a pure OO language: Everything is an object. Classes are a special kind of object used to create other objects. Even the messages passed to objects (the Smalltalk replacement for function calls in procedural languages) are themselves objects.

One of the most important reasons for learning Smalltalk is that the syntax is not C-like. Most recent languages have adopted C-like syntax to make themselves more appealing to a generation of C programmers. This fact has led to a widespread belief that C syntax is the "correct" way of designing a programming language. Smalltalk was developed a few years after C, but before C gained widespread adoption, and so didn’t inherit the syntax.

A statement in Smalltalk, like an imperative statement in a natural language, contains a subject, a verb, and optionally an object. Once you’re familiar with the syntax, one thing will strike you about Smalltalk: The language is so "small" that it’s almost nonexistent.

Smalltalk-the-language doesn’t even include conditional statements. In fact, the only kind of statement in Smalltalk is a message-passing statement. Conditionals are implemented in the library; you pass a message containing a block of code to a Boolean object, and it executes it if the Boolean object is true. The power of this approach is quickly obvious: Since all flow-control structures are part of the language, you can define your own very easily. Do you want a for-each control structure? Simply add a method to your collection class that takes a block of code as an argument and executes it with each object in the collection.

  • + Share This
  • 🔖 Save To Your Account