| |
| |
Preface | |
| |
| |
Acknowledgments | |
| |
| |
| |
Introduction | |
| |
| |
| |
Decomposition and Abstraction | |
| |
| |
| |
Abstraction | |
| |
| |
| |
Abstraction by Parameterization | |
| |
| |
| |
Abstraction by Specification | |
| |
| |
| |
Kinds of Abstractions | |
| |
| |
| |
The Remainder of the Book | |
| |
| |
Exercises | |
| |
| |
| |
Understanding Objects in Java | |
| |
| |
| |
Program Structure | |
| |
| |
| |
Packages | |
| |
| |
| |
Objects and Variables | |
| |
| |
| |
Mutability | |
| |
| |
| |
Method Call Semantics | |
| |
| |
| |
Type Checking | |
| |
| |
| |
Type Hierarchy | |
| |
| |
| |
Conversions and Overloading | |
| |
| |
| |
Dispatching | |
| |
| |
| |
Types | |
| |
| |
| |
Primitive Object Types | |
| |
| |
| |
Vectors | |
| |
| |
| |
Stream Input/Output | |
| |
| |
| |
Java Applications | |
| |
| |
Exercises | |
| |
| |
| |
Procedural Abstraction | |
| |
| |
| |
The Benefits of Abstraction | |
| |
| |
| |
Specifications | |
| |
| |
| |
Specifications of Procedural Abstractions | |
| |
| |
| |
Implementing Procedures | |
| |
| |
| |
Designing Procedural Abstractions | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Exceptions | |
| |
| |
| |
Specifications | |
| |
| |
| |
The Java Exception Mechanism | |
| |
| |
| |
Exception Types | |
| |
| |
| |
Defining Exception Types | |
| |
| |
| |
Throwing Exceptions | |
| |
| |
| |
Handling Exceptions | |
| |
| |
| |
Coping with Unchecked Exceptions | |
| |
| |
| |
Programming with Exceptions | |
| |
| |
| |
Reflecting and Masking | |
| |
| |
| |
Design Issues | |
| |
| |
| |
When to Use Exceptions | |
| |
| |
| |
Checked versus Unchecked Exceptions | |
| |
| |
| |
Defensive Programming | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Data Abstraction | |
| |
| |
| |
Specifications for Data Abstractions | |
| |
| |
| |
Specification of IntSet | |
| |
| |
| |
The Poly Abstraction | |
| |
| |
| |
Using Data Abstractions | |
| |
| |
| |
Implementing Data Abstractions | |
| |
| |
| |
Implementing Data Abstractions in Java | |
| |
| |
| |
Implementation of IntSet | |
| |
| |
| |
Implementation of Poly | |
| |
| |
| |
Records | |
| |
| |
| |
Additional Methods | |
| |
| |
| |
Aids to Understanding Implementations | |
| |
| |
| |
The Abstraction Function | |
| |
| |
| |
The Representation Invariant | |
| |
| |
| |
Implementing the Abstraction Function and Rep Invariant | |
| |
| |
| |
Discussion | |
| |
| |
| |
Properties of Data Abstraction Implementations | |
| |
| |
| |
Benevolent Side Effects | |
| |
| |
| |
Exposing the Rep | |
| |
| |
| |
Reasoning about Data Abstractions | |
| |
| |
| |
Preserving the Rep Invariant | |
| |
| |
| |
Reasoning about Operations | |
| |
| |
| |
Reasoning at the Abstract Level | |
| |
| |
| |
Design Issues | |
| |
| |
| |
Mutability | |
| |
| |
| |
Operation Categories | |
| |
| |
| |
Adequacy | |
| |
| |
| |
Locality and Modifiability | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Iteration Abstraction | |
| |
| |
| |
Iteration in Java | |
| |
| |
| |
Specifying Iterators | |
| |
| |
| |
Using Iterators | |
| |
| |
| |
Implementing Iterators | |
| |
| |
| |
Rep Invariants and Abstraction Functions for Generators | |
| |
| |
| |
Ordered Lists | |
| |
| |
| |
Design Issues | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Type Hierarchy | |
| |
| |
| |
Assignment and Dispatching | |
| |
| |
| |
Assignment | |
| |
| |
| |
Dispatching | |
| |
| |
| |
Defining a Type Hierarchy | |
| |
| |
| |
Defining Hierarchies in Java | |
| |
| |
| |
A Simple Example | |
| |
| |
| |
Exception Types | |
| |
| |
| |
Abstract Classes | |
| |
| |
| |
Interfaces | |
| |
| |
| |
Multiple Implementations | |
| |
| |
| |
Lists | |
| |
| |
| |
Polynomials | |
| |
| |
| |
The Meaning of Subtypes | |
| |
| |
| |
The Methods Rule | |
| |
| |
| |
The Properties Rule | |
| |
| |
| |
Equality | |
| |
| |
| |
Discussion of Type Hierarchy | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Polymorphic Abstractions | |
| |
| |
| |
Polymorphic Data Abstractions | |
| |
| |
| |
Using Polymorphic Data Abstractions | |
| |
| |
| |
Equality Revisited | |
| |
| |
| |
Additional Methods | |
| |
| |
| |
More Flexibility | |
| |
| |
| |
Polymorphic Procedures | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Specifications | |
| |
| |
| |
Specifications and Specificand Sets | |
| |
| |
| |
Some Criteria for Specifications | |
| |
| |
| |
Restrictiveness | |
| |
| |
| |
Generality | |
| |
| |
| |
Clarity | |
| |
| |
| |
Why Specifications? | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Testing and Debugging | |
| |
| |
| |
Testing | |
| |
| |
| |
Black-Box Testing | |
| |
| |
| |
Glass-Box Testing | |
| |
| |
| |
Testing Procedures | |
| |
| |
| |
Testing Iterators | |
| |
| |
| |
Testing Data Abstractions | |
| |
| |
| |
Testing Polymorphic Abstractions | |
| |
| |
| |
Testing a Type Hierarchy | |
| |
| |
| |
Unit and Integration Testing | |
| |
| |
| |
Tools for Testing | |
| |
| |
| |
Debugging | |
| |
| |
| |
Defensive Programming | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Requirements Analysis | |
| |
| |
| |
The Software Life Cycle | |
| |
| |
| |
Requirements Analysis Overview | |
| |
| |
| |
The Stock Tracker | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Requirements Specifications | |
| |
| |
| |
Data Models | |
| |
| |
| |
Subsets | |
| |
| |
| |
Relations | |
| |
| |
| |
Textual Information | |
| |
| |
| |
Requirements Specifications | |
| |
| |
| |
Requirements Specification for Stock Tracker | |
| |
| |
| |
The Data Model | |
| |
| |
| |
Stock Tracker Specification | |
| |
| |
| |
Requirements Specification for a Search Engine | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Design | |
| |
| |
| |
An Overview of the Design Process | |
| |
| |
| |
The Design Notebook | |
| |
| |
| |
The Introductory Section | |
| |
| |
| |
The Abstraction Sections | |
| |
| |
| |
The Structure of Interactive Programs | |
| |
| |
| |
Starting the Design | |
| |
| |
| |
Discussion of the Method | |
| |
| |
| |
Continuing the Design | |
| |
| |
| |
The Query Abstraction | |
| |
| |
| |
The WordTable Abstraction | |
| |
| |
| |
Finishing Up | |
| |
| |
| |
Interaction between FP and UI | |
| |
| |
| |
Module Dependency Diagrams versus Data Models | |
| |
| |
| |
Review and Discussion | |
| |
| |
| |
Inventing Helpers | |
| |
| |
| |
Specifying Helpers | |
| |
| |
| |
Continuing the Design | |
| |
| |
| |
The Design Notebook | |
| |
| |
| |
Top-Down Design | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Between Design and Implementation | |
| |
| |
| |
Evaluating a Design | |
| |
| |
| |
Correctness and Performance | |
| |
| |
| |
Structure | |
| |
| |
| |
Ordering the Program Development Process | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Design Patterns | |
| |
| |
| |
Hiding Object Creation | |
| |
| |
| |
Neat Hacks | |
| |
| |
| |
Flyweights | |
| |
| |
| |
Singletons | |
| |
| |
| |
The State Pattern | |
| |
| |
| |
The Bridge Pattern | |
| |
| |
| |
Procedures Should Be Objects Too | |
| |
| |
| |
Composites | |
| |
| |
| |
Traversing the Tree | |
| |
| |
| |
The Power of Indirection | |
| |
| |
| |
Publish/Subscribe | |
| |
| |
| |
Abstracting Control | |
| |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
Glossary | |
| |
| |
Index | |