This work is the product of two decades of discussions about the art of programming, as well as the art of teaching programming. We feel the result is a positive step toward introducing our craft to students with all levels of interest in computer science. Teaching, as we do, at liberal arts institutions, it is interesting that frequently the best students in introductory classes dabble in programming as passersby. Our special hope is that this book conveys to those individuals what makes us computer scientists.
Pedagogy. At the time of this writing the academic community is considering many fundamental questions; their answers will dictate the immediate future of computer science education.
element
package. It
is a free, open, clean, well defined environment that supports a
simple system for performing object-oriented graphics. Avoiding
direct use of the AWT (Abstract Windowing Toolkit) has enabled us to insulate the sprouting
programmer from a system whose motivation in design is not necessarily
ease of use in the classroom. When the student is ready to make the
transition to using the AWT, we have sought to maintain as consistent
a viewpoint on graphics as possible. This package also provides textual
input and output facilities that (we believe) are necessary in one's
first programming environment.
Using the Text. The path through the text involves a number of important steps. First, we introduce the use of objects almost immediately. The design of objects occurs relatively late in the book. At that time, we believe the student will have the maturity necessary to construct larger projects.
Recursion is introduced relatively early and can be avoided, but our experience is that students enjoy the naive novelty of the use of recursion to solve all sorts of problems. At one time, recursion was considered wasteful of machine resources, but now it is an important programming tool at nearly every level of programming.
We have had to select a particular order for
Chapters 5 (strings) through 8
(classes), but there is nothing particularly important to
approaching this material in this order. For example, we introduce
String
s before arrays, but nothing within the chapters
obviates approaching the material in the reverse order. In
particular, some instructors looking for an ``objects-first'' approach
will find they can get a significant jump on the development of
classes by addressing the material of Chapter 8
first.
The later chapters should be considered hooks into subsequent parts of the computer science curriculum---recursive data structures (here, lists) are, of course, a useful introduction to the subtleties of data structure design. They provide, in fact, an alternative implementation to the one discussed the follow-on book, Java Structures. The chapter on threads is provided for those students interested in programming multiple-agent programs. Concurrency is an increasingly potent tool for solving problems, and Java makes that possible within the first semester. Finally, our chapter on machines is a light introduction to three architectures---the Java Virtual Machine, the Turing Machine, and the P-RAM. Each a virtual machine that has had a significant effect on the course of computer science, and each demonstrates a rich set of computer science problems other than just learning how to program.
We have worked hard to build in a number of resources for students to test their progress.
Following Along. A number of features of this book make it unique. First, all the software in this book was extracted from on-line code. Thus, we can be reasonably sure that everything we say here is ``as true as possible.'' We've placed two different icons in the margin (see right) to highlight the details of the text. The ``meshing gears'' icon is used to highlight working programs that can be found at our web site. The ``compass'' icon identifies important principles of program design we have sprinkled throughout the text. For example, we suggest that
Principle 1. A useful principle is not fact, but a guide.
The observant reader realizes that even with a compass, true north is slightly elusive. We hope our principles set you in the right direction.