Preface

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 of

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.

Overview and Organization

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 and animations.

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.

Features

This text has a number of noteworthy pedagogical features:

Ancillaries

The following ancillary materials are available:

  1. Programming environment: Smalltalk Express, a complete Smalltalk development environment from Objectshare Systems, can be downloaded free of charge from Objectshare's Web site, www.objectshare.com. Smalltalk Express contains a 16-bit Smalltalk that runs under Windows 3.1 or higher, and WindowBuilder Pro, an interface builder.
  2. Transparency masters: More than 75 transparency masters are available to adopters of the text. The masters include screen shots, diagrams, tables, and other material from the text. See liberty.uc.wlu.edu/~lambertk for details.
  3. Source code: To give students direct access to some of the examples in the text, some source code can be downloaded from the authors' Web sites.
  4. Course plans: The authors will give tips for organizing a short course that uses the text to any adopters. See Lambert's Web page for details.

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 klambert@wlu.edu so they can be corrected in subsequent printings and editions.

Acknowledgments

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.