Next:
1. From Scheme to
Notes on
Object-Oriented Program Design
Robert ``Corky'' Cartwright
Copyright 1999
Please send corrections and comments to cork@rice.edu
1. From Scheme to Java
1.1 Introduction
1.1.1 What is an Object?
1.2 Java Mechanics
1.2.1 Notation and Syntax
1.2.2 Java Expressions
1.2.3 Precedence of Operations
1.2.4 Java Statements
1.2.5 The Structure of Java Programs
1.2.6 Static Members
1.2.7 Java Programs
1.2.7.1 A Sample Java Program
1.2.7.2 Variations on the Sample Program
1.2.8 Defining Static Methods
1.2.9 Capitalization and Commenting Conventions
1.3 Java Data Types
1.3.1 Primitive Types
1.3.1.0.1 Numeric Constants
1.3.1.0.2 Conversions Between Types
1.3.2 Object Types
1.4 Java Class Definitions
1.4.1 Defining Classes to Represent Compound Data
1.4.2 Constructors
1.4.3 Defining Instance Methods
1.4.4 Printing Objects
1.5 The Union and Composite Patterns
1.5.1 Member Hoisting
1.5.2 The Composite Pattern
1.5.2.0.1 When Unions are Composite
1.5.3 Defining Instance Methods for a Composite Class
1.5.4 Conditional Statements
1.6 Basic Program Design
1.6.1 The Design Recipe
1.6.1.1 Data Analysis and Design
1.6.1.2 Contract and Header
1.6.1.3 Examples
1.6.1.4 Template
1.6.1.5 Body
1.6.1.6 Test
1.6.2 An Extended Example: Lists
1.6.2.1 Type Predicates and Type Casts in Java
1.6.2.2 Avoiding the Use of the
instanceof
test
1.6.2.3 Maintaining Sample Test Data
1.6.2.4 A Sample Program
1.6.3 Inheritance and the Composite Pattern
1.6.3.1 Overriding
equals
1.6.4 Help Methods, Packages, and Visibility
1.7 Using Classes to Enforce Invariants
1.8 Interfaces
1.8.1 Multiple Inheritance
1.8.2 Implicit Polymorphism
1.8.3 Interface Types
1.9 The Command Pattern
1.10 Static Members of Classes
1.10.1 Singleton Pattern
1.10.2 Other Uses of Static Members
1.11 Loose Ends
1.11.1 Local variables
1.11.2 Casts and Static Type Checking
1.11.3 Exceptions as Errors
1.11.4 Name and Method Overloading
1.12 The Visitor Pattern
1.12.1 Interpreting Arithmetic Expressions
1.12.2 Openness in Data Design
1.12.3 Polymorphic Visitors
1.12.4 Polymorphic Visitors with Arguments
1.13 Unusual Situations versus Runtime Errors
1.13.1 A Motivating Example
1.13.2 Using Java Exceptions
1.13.3 Exception Handling
2. Object-Oriented Data Structures
2.1 Sequences
2.1.1 Arrays
2.1.1.1 Recipes for Processing Arrays
2.1.2 Lists
2.1.3 Immutable Sequences
2.1.4 Mutable Sequences
2.1.4.1 Singly-linked Mutable List Representation
2.1.4.2 Extended Mutable Lists: Nested Classes
2.1.4.3 Nested Classes vs. Inner Classes
2.1.4.4 Spaghetti References (akin to spaghetti code)
2.1.4.5 The Iterator Pattern
2.1.5 An Implementation
2.1.5.1 BiLists and Their Iterators
2.1.6 Alternate Representations of Lists
2.1.6.1 Arrays
2.1.7 Hybrid Representations of Sequences
3. Graphical User Interfaces
3.1 GUI Programming
3.1.1 Model-View-controller Pattern
3.1.2 How to Write a View
3.1.2.0.1 Warning
3.1.2.0.2 Coding the View Class
3.1.3 How to Write a Trivial Model
3.1.4 How to Write a Controller
3.2 What is Concurrent Programming?
3.2.0.1 Synchronized methods and statements
3.2.1 Deadlock
About this document ...
Corky Cartwright
2000-01-07