Home Site

    Page 45
16.4 Table of Contents Bottom of Page Site Map
Have You Considered Smalltalk?
Smalltalk Fundamentals
By Jeffrey D. Panici
It is amazing how quickly something becomes the de facto
standard in our industry. Take Java, for instance. Not even a decade old and already companies, universities, and independent programmers have eschewed all other choices in favor of this dark brewed wonder. However, from a technical standpoint, does Java really deserve this rapid exaltation?
When comparing Java to C++, Java has some very
positive aspects. On the other hand, there are instances where C++ is the correct choice and not the hindrance often portrayed by the media. Many companies, who were building their internal enterprise infrastructure with C++, are choosing Java because it seems close enough to C++.
There are other languages besides C++, so why is it
always necessary to compare everything to C++? Instead of comparing Java with C++, consider comparing Java with Smalltalk. After all, Smalltalk inspired Java more than C++. In addition, vendors have positioned Smalltalk to service the same set of problems as Java, namely enterprise business software and there are several Smalltalks on the market that out perform Java for developing shrink-wrap software.

A Crash Course in Smalltalk

To set the stage we start with a quick introduction to
Smalltalk. There are two aspects to consider when dealing with Smalltalk. The first is the language itself, which is incredibly simple and consistent across vendor products. The second is each Smalltalk vendor's product. While all of the Smalltalk products on the market today follow the same basic design, there are important differences.

100% Object Oriented - No Cream Please

Smalltalk is 100% object-oriented; often called a pure
object-oriented system. There is confusion since many believe that Java is also 100% object-oriented. There are no primitive types in Smalltalk, as there are in Java, which requires explicit conversion to and from object form. In addition, there is inheritance from any class within a Smalltalk image without restriction. These two traits represent enormous design latitude for the Smalltalk programmers, which are not available to the Java programmer. The programmer no longer
concerns himself with a multi-paradigm type system nor works around arbitrary vendor specified firewalls within a class library. Although many argue the benefits of a single paradigm programming language, especially those that are object-oriented in nature, Smalltalk's simple and consistent paradigm has demonstrated that it allows rapid software development.

An Object Database

Before moving on, there is a term mentioned above that
might not be familiar. An image is a type of object database that stores an active snapshot of the entire Smalltalk development environment. Since many Smalltalk development environments use green threads (also called fibers under Windows), an image also saves an exact snapshot of every task currently running. When reloading the image, everything returns to the state it was in when Smalltalk created the image. This is an extremely powerful tool and the image itself can store any type of data.

A Natural Language Approach

Smalltalk's syntax is very similar to that of a natural
language. The syntax pattern is always object verb. In Smalltalk parlance, one calls the verb a message and one sends these messages to an object. When reading Smalltalk, always read it left-to-right, without exception as it makes reading and writing the language very easy.
There are three different forms of this basic linguistic
construct in Smalltalk. If this were a grammar class, these would be our cases:

'Hello World' asUppercase.
1 + 2.
'Hello World' beginsWith: 'Hello'.

The first is the unary case, where the object (a String in
this case) receives the message asUppercase.
The second is the binary case, where the SmallInteger 1
receives the message + with a single SmallInteger parameter of 2. The binary case is only available on a limited number of selectors, which varies by Smalltalk. The term selector is a synonym for method in Smalltalk, but it specifically refers to the key in a method dictionary.

To Page 44

16.4 Table of Contents
Top of Page

To Page 46

16.4 2002

PC AI Magazine - PO Box 30130 Phoenix, AZ 85046 - Voice: 602.971.1869 Fax: 602.971.2321
e-mail: info@pcai.com - Comments? webmaster@pcai.com