In similar and ever increasing fashion, naive programmers use visual, ``drag and drop'' languages to program applications for home, school, and office use. Naive programming will play a crucial role in satisfying the exploding demand for software, but there will always be limits---just as no hospital patient would submit to a surgery conducted by a naive surgeon, no customer of a complex or safety-critical system will settle for software written by anyone but a properly trained, professional programmer.
This textbook is meant for a first course for future professional programmers and computing scientists.
What makes ``professional programming'' different from naive programming? The answer lies in use of structures---control structures (sequencing, conditionals, iteration, parallelism), data structures (arrays, stacks, trees), and component structures (modules, classes, objects, packages). Professional programmers understand how to employ properly all three forms of structure; amateurs do not. Further, patterns of structures-within-structures define architectures that are learned and regularly imitated by professionals. As indicated by its title, this text presents standard architectures for component construction and patterns of control construction and data construction.
The text takes a ``modern'' approach by emphasizing component structures over the other two forms. Computing has matured into a distributed, component-based activity, where both computer hardware and software are assembled from standardized components and connected together by means of standardized interfaces. By no means does this text ignore the classic developments of control and data structures---they appear in due course at an appropriate level of detail. But component-level issues drive the software design process, and the text emphasizes this fact.
Java is used as the programming language in this text because it supplies solid support for component-structure-driven design; its control and data structuring mechanisms are adequate as well. Because Java and its support library are huge, only a carefully selected subset that promotes sound programming techniques is presented.
Most sections in the text end with a short exercises section that suggests simple ways to apply and modify the programs in the section. Work at least one or two of the exercises before you proceed to the next section, and if you have difficulty with an exercise, do not hesitate to reread the section. It is rare for anyone to understand a new concept after just one reading, and a technical topic like programming requires careful, thoughtful effort for deep understanding. Remember that progress is measured by the number of concepts and structures that you can use well and not by the number of pages you have read or number of programs you have typed.
Each Chapter concludes with a collection of projects that test your abilities to design and build complete programs. The projects are roughly ordered in terms of difficulty, and many are written so that you can ``customize'' them into a product that you or others would enjoy using---take time to make your final result one you would be proud to demonstrate to others.
Like video recorders and microwave ovens, programs come with instructions. When you study the example programs in the text, pay attention to the ``instructions'' (documentation) that are included. Because programs and program components are useless without documentation, you must develop the habit of documenting the programs you write. This activity pays huge dividends when you start building large, complex programs.
The Java programming language is used as the working language in this text. Java is by no means perfect, but it supports the crucial structures for programming, and it provides mechanisms for ``fun'' activities like graphics and animation. Chapter 2 states partial instructions for installing Java on your computer, but if you are inexperienced at installing software, you should seek help.
The programming examples from the text and other supporting materials can be found at the URL http://www.cis.ksu.edu/santos/schmidt/ppj.
Here are some pragmatic issues and how they are handled by the text:
As part of the design process, components are first specified with UML/Java-style interfaces before any code is written. (An interface lists the names of the public methods and private attributes a class needs to do its job.) For complex applications, UML class diagrams are drawn.
The text does not use any specially written classes or packages supplied by the author---only the standard Java packages are used. This prevents a beginner from becoming dependent on nonstandard variants of Java and relieves the instructor of the headache of installing custom packages on classroom computers and students' personal computers.
Although the choice of Java as the text's programming language is basically sound, the language possesses several annoying features. One that simply cannot be avoided is using the static method, main, to start an application's execution. To avoid tedious explanations of static methods and classes from which no objects are ever created, the text naively claims in Chapter 2 that an application's start-up class (that is, the one that contains main) generates a ``start-up'' object. Technically, this is incorrect, but it allows a beginner to stick with the axiom, ``Classes Generate Objects,'' which is promoted from Chapter 1 onwards. The remainder of the text presents the syntax and semantics of Java in technically correct detail.
The programming examples from the text and other supporting materials can be found at the URL http://www.cis.ksu.edu/santos/schmidt/ppj.
Richard Jones and Robert Horan of Scott/Jones Press deserve special thanks for their initial interest in the text, their tolerance of my rewritings, and their recruitment of the following review team, whose commentaries led the text into its final form: REVIEWERS' NAMES HERE.
The book's first draft was written while I spent part of a sabbatical year at Aarhus University, Denmark; I thank Olivier Danvy for hosting my visit. Subsequent drafts were written during periods when I was supported by the National Science Foundation, the Defense Advanced Research Projects Agency, and the National Aeronautics and Space Administration; I thank my project managers, Frank Anger (NSF), Helen Gill (DARPA), and Mike Lowry (NASA) for tolerating what I hope will be judged a substantial contribution to programming.
Finally, during the period of time this book was written, my mother,
Frances Louise Walters Schmidt, died; I dedicate the text to her.