This book assumes that the reader has learned
how to program a computer but has not yet experienced the full
power of object-oriented software development. This will most
certainly be true of readers who know just Pascal, C, or Basic,
but will also be true of many readers who know C++ as well. In
particular, students who learn C++ in college-level CS1 and CS2
courses often come away with a very superficial understanding
Our aim is to provide a book that fills these gaps. The book can be used as a text for a short course on Smalltalk or as supplement in courses on programming languages or user interface design or object-oriented software development Smalltalk is not just a programming language, but a suite of tools designed from the ground up to support object-oriented software development and the programming of graphical user interfaces. Smalltalk was created to do these things long before the object-oriented revolution of the last ten years and the introduction of a stream of new languages such as C++, Eiffel, and, most recently, Java. In our judgment, Smalltalk remains the cleanest, simplest, most natural platform on which to explore and master object-oriented concepts, even if one ultimately turns to C++ for commercial development. Moreover, the use of Smalltalk is growing in industry, as companies seek to integrate object-oriented components and graphical user interfaces into their information systems.
Chapter 1 introduces the major object-oriented
concepts and the mechanisms that implement them. These concepts
are defined and illustrated with several simple examples written
in pseudocode. The chapter serves as a conceptual framework for
the rest of the book.
Chapter 2 begins with an overview of the
history of Smalltalk. It then presents short code segments written
in Smalltalk alongside equivalent segments written in pseudocode.
This overview of Smalltalk syntax is followed by a discussion
of the numeric classes and a demonstration of how to run and debug
simple Smalltalk programs. Building on the skills already possessed
by C and Pascal programmers, the approach in this and the next
chapter is very gradual and gentle.
Chapter 3 introduces the Smalltalk collection
classes. Some of this material will be familiar to students who
have taken a data structures course; however they will be amazed
at the simplicity of working with data structures in Smalltalk.
A data management application is developed and rewritten using
several alternative collection classes. The chapter then introduces
the use of browsers to read, modify, and create Smalltalk classes.
Here we effect a transition from a procedural style of programming
to an object-oriented style. The chapter concludes with a discussion
of the way in which true object-oriented programming entails the
"disappearance" of programs in the conventional sense.
Chapter 4 provides an overview of graphical
user interfaces. Smalltalk includes a wide range of GUI classes;
and to use them students need only learn how to code the event
handlers for each type of GUI object. Smalltalk includes an interface
builder to lay out and design complex interfaces. For these reasons,
students can develop applications with GUIs after only a few weeks
of experience in Smalltalk.
Chapter 5 explores the development of a
complex application. Students are taken through each phase of
the development life cycle: Analysis, design, implementation,
and testing. Important design aids such as object model diagrams,
object interaction graphs, and visibility graphs, are discussed
and used. We also discuss the advantages of separating an application's
interface and its data model.
Chapter 6 gives an overview of stream and
file processing in Smalltalk. These mechanisms are required in
order to make a data model persistent.
Chapter 7 takes students through the features
of Smalltalk that support graphics programming. After examining
the classes for representing points, geometric shapes, pens, and
display media, we use these to develop some simple drawing applications
Throughout the text, we try to flatten the learning curve normally associated with Smalltalk by introducing only the most commonly used classes and their methods. We illustrate each new concept with some simple examples before presenting more realistic applications.
This text has a number of noteworthy pedagogical features:
The following ancillary materials are available:
All the code in the book has been run using
Smalltalk Express and hopefully is free of bugs. However, during
the book's many rewrites, errors may have crept back in. Every
effort has been made to provide an error-free text, though this
cannot be guaranteed with certainty. We assume full responsibility
for any errors that may remain, but ask that readers report them
to email@example.com so they can be corrected in subsequent printings
We would like to take this opportunity to
thank those who contributed to the production of this text. Several
reviewers contributed significant criticism during the manuscript's
development. They include:
Seth Bergmann Rowan College of New Jersey
Michael Berman Rowan College of New Jersey
Benedict Dugan University of Washington
Raymond Ege Florida International University
Jon Pearce San Jose State College
Stephen R. Schach Vanderbilt University
Hoyt D. Warner Western New England College
We would also like to thank Halee Dinsey,
developmental editor, Debra Pickett, promotion manager, Andrea
Peters, production editor, and Jerry Westby, executive editor.
Without their expertise, this book would not exist.
Lastly, we thank the many people who developed Smalltalk Express, Microsoft Word, and the Internet. These tools greatly eased our burden.