By Lynn Andrea Stein
How to Use This EBook
Interactive Programming is designed for use by students who have no prior programming experience (typically college freshmen). It ultimately teaches both the fundamentals of computer programming and the details of the Java programming language.
Interactive Programming is designed for use by students who have no prior programming experience (typically college freshmen). It ultimately teaches both the fundamentals of computer programming and the details of the Java programming language.
The book is divided into five parts. The first briefly overviews the idea of programs built out of communities of interacting entities. The second part introduces the mechanics of Java programming, from things, types, and names to objects and classes. It is essential to the book and is intended to be read in the order presented. Part three elaborates on these ideas, introducing threads as first-class citizens of the programming world and exploring inheritance, exception-handling, and design. Part four emphasizes a variety of issues in the design of an individual entity. It is not necessary to read this section in any particular order, and certain chapters can be omitted entirely without serious detriment. Part five similarly surveys a variety of interrelated topics, in this case concerning the ways in which communities are coupled together, and its chapters, too, can be taken out of order or omitted.
The five parts, taken together, constitute a single-semester introductory course in computer programming. In such a course, some of the supplementary material (described below) will not be used. For a one-quarter course, part five and selected earlier chapters should probably be omitted. Alternately, the complete book can be spread over two quarters or over a full year, augmented as necessary from the supplementary materials.
Part By Part
Part 1 is brief and introductory, providing an overview of the approach to computer programming taken. Part 2 begins with the basic syntax and semantics of programming constructs. At the same time, from the earliest examples, students are introduced to concurrent, interactive, embedded programs. For example, interfaces are introduced early as they specify a contract between two parts of a computer system. By the middle of part 3, students have learned to write what might in other contexts be called "stand-alone" programs -- complete programs including class definitions and a main routine. They have also learned that every program is a part of a system of interacting entities -- including the user, libraries and other software, hardware, etc. -- and that no program truly stands alone.
Part 1 is brief and introductory, providing an overview of the approach to computer programming taken. Part 2 begins with the basic syntax and semantics of programming constructs. At the same time, from the earliest examples, students are introduced to concurrent, interactive, embedded programs. For example, interfaces are introduced early as they specify a contract between two parts of a computer system. By the middle of part 3, students have learned to write what might in other contexts be called "stand-alone" programs -- complete programs including class definitions and a main routine. They have also learned that every program is a part of a system of interacting entities -- including the user, libraries and other software, hardware, etc. -- and that no program truly stands alone.
The remainder of the book addresses issues and alternatives that arise in the design of software communities. Part 4 focuses on ways to extend the basic entities that students build. The notion of a dispatching control loop provokes an exploration of procedural abstraction, in which separate routines handle each possible case. This in turn leads to a de-emphasis of the central control loop and a shift to event-driven programming, in which individual "handler" procedures take center stage. In a typical event system, dispatch may be provided implicitly, i.e., by underlying hardware or software. A third model -- smart objects that handle their own behavior -- is also explored. Java's AWT is introduced as both a tool and an example of an event-based system.
Part 5 addresses the issue of how entities are tied together. A recurring theme -- throughout the book, but emphasized here -- concerns interface design. This refers both to the Java construct -- a signature specification, introduced in chapter 4 -- and to the more general concept, including human (user) interface design. In addition to learning how to specify an interface, students learn what the interface does not specify. In other chapters, students learn about streams, messages, and shared memory, about connecting to objects in the same name space and to those running under different processes or on different machines, and about how to communicate with them. They also learn the basic ideas of safety and liveness, that shared mutable state can lead to program failures, and some simple mechanisms for coping with them. They do not, of course, learn to build arbitrarily complex programs that avoid deadlock under all circumstances. This topic will be visited later in the computer science curriculum. Instead, they learn to recognize the general preconditions for the possibility of safety failures and the kinds of solutions that might be possible. The goal, throughout this course, is to give students the basic conceptual vocabulary that will allow them to ask the right questions as they meet more complex issues later in their education.
Interactive Programming ends with an overview of various patterns of large-scale systems architecture, reviewing tradeoffs among various approaches and providing a common language for software architects. The last chapter examines conventional patterns by which complex concurrent and distributed systems are constructed. The emphasis is on designing and understanding a variety of interactive communities. This chapter also leads naturally into final projects. In courses taught using this curriculum and preliminary drafts of the book, typical final projects have included client/server chat programs and networked video games. Not what you would generally expect from first semester freshmen!