search for books and compare prices
Tables of Contents for An Introduction to Object-Oriented Programming
Chapter/Section Title
Page #
Page Count
Preface
v
 
1 Thinking Object-Oriented
1
26
1.1 Why Is OOP Popular?
1
1
1.2 Language and Thought
2
4
1.2.1 Eskimos and Snow
3
1
1.2.2 An Example from Computer Languages
3
2
1.2.3 Church's Conjecture and the Whorf Hypothesis
5
1
1.3 A New Paradigm
6
1
1.4 A Way of Viewing the World
7
7
1.4.1 Agents, Responsibility, Messages, and Methods
7
2
1.4.2 Responsibilites
9
1
1.4.3 Classes and Instances
9
1
1.4.4 Class Hierarchies-Inheritance
10
2
1.4.5 Method Binding, Overriding, and Exceptions
12
1
1.4.6 Summary of Object-Oriented Concepts
13
1
1.5 Computation as Simulation
14
2
1.5.1 The Power of Metaphor
15
1
1.5.2 Avoiding Infinite Regression
15
1
1.6 Coping with Complexity
16
5
1.6.1 The Nonlinear Behavior of Complexity
16
1
1.6.2 Abstraction Mechanisms
17
4
1.7 Reusable Software
21
1
1.8 Summary
22
5
2 Object-Oriented Design
27
20
2.1 Responsibility Implies Noninterference
27
1
2.2 Programming in the Small and in the Large
28
1
2.3 Why Begin with Behavior?
29
1
2.4 A Case Study in RDD
29
3
2.4.1 The Interactive Intelligent Kitchen Helper
30
1
2.4.2 Working through Scenarios
31
1
2.4.3 Identification of Components
31
1
2.5 CRC Cards-Recording Responsibility
32
2
2.5.1 Give Components a Physcial Representation
32
1
2.5.2 The What/Who Cycle
33
1
2.5.3 Documentation
33
1
2.6 Components and Behavior
34
4
2.6.1 Postponing Decisions
35
1
2.6.2 Preparing for Change
35
1
2.6.3 Continuning the Scenario
36
2
2.6.4 Interaction Diagrams
38
1
2.7 Software Components
38
1
2.7.1 Behavior and State
38
1
2.7.2 Instances and Classes
39
1
2.7.3 Coupling and Cohesion
40
1
2.7.4 Interface and Implementation--Parnas's Principles
40
1
2.8 Formalize the Interface
41
3
2.8.1 Coming up with Names
42
2
2.9 Designing the Representation
44
1
2.10 Implementing Components
44
1
2.11 Integration of Components
45
1
2.12 Maintenance and Evolution
45
2
3 Classes and Methods
47
26
3.1 Encapsulation
47
1
3.2 Varieties of Classes
48
2
3.3 Example: A Playing Card
50
1
3.4 Interface and Implementation
51
1
3.5 Classes and Methods
52
21
3.5.1 Classes and Methods in Object Pascal
52
4
3.5.2 Classes and Methods in Smalltalk
56
3
3.5.3 Classes and Methods in Objective-C
59
4
3.5.4 Classes and Methods in C++
63
3
3.5.5 Classes and Methods in Java
66
7
4 Messages, Instances, and Initialization
73
22
4.1 Message-Passing Syntax
73
6
4.1.1 Message Passing Syntax in Object Pascal
74
1
4.1.2 Message-Passing Syntax in C++
75
2
4.1.3 Message-Passing Syntax in Java
77
1
4.1.4 Message-Passing Syntax in Smalltalk
77
1
4.1.5 Message-Passing Syntax in Objective-C
78
1
4.2 Issues in Creation and Initialization
79
3
4.2.1 Stack versus Heap Storage Allocation
79
1
4.2.2 Memory Recovery
80
1
4.2.3 Pointers
81
1
4.2.4 Immutable Creation
81
1
4.3 Mechanisms for Creation and Initialization
82
13
4.3.1 Creation and Initialization in C++
82
4
4.3.2 Creation and Initialization in Java
86
2
4.3.3 Creation and Initialization in Objective-C
88
1
4.3.4 Creation and Initialization in Object Pascal
89
2
4.3.5 Creation and Initialization in Smalltalk
91
4
5 A Case Study: The Eight Queens Puzzle
95
20
5.1 The Eight-Queens Puzzle
95
2
5.1.1 Creating Objects That Find Their Own Solution
96
1
5.2 Using Generators
97
3
5.2.1 Initialization
97
2
5.2.2 Finding a Solution
99
1
5.2.3 Advancing to the Next Position
100
1
5.3 The Eight-Queens Puzzle in Each Language
100
15
5.3.1 The Eight-Queens Puzzle in Object Pascal
101
3
5.3.2 The Eight-Queens Puzzle in C++
104
2
5.3.3 The Eight-Queens Puzzle in Java
106
3
5.3.4 The Eight-Queens Puzzle in Objective-C
109
2
5.3.5 The Eight-Queens Puzzle in Smalltalk
111
4
6 A Case Study: A Billiards Game
115
14
6.1 The Elements of Billiards
115
1
6.2 Graphical Objects
116
7
6.2.1 The Wall Graphical Object
117
1
6.2.2 The Hole Graphical Object
118
1
6.2.3 The Ball Graphical Object
119
4
6.3 The Main Program
123
1
6.4 Using Inheritance
124
5
7 Inheritance
129
20
7.1 An Intuitive Description of Inheritance
129
1
7.2 Subclass, Subtype, and Substitutability
130
1
7.2.1 Subtypes and Strong Typing
131
1
7.3 Forms of Inheritance
131
5
7.3.1 Subclassing for Specialization (Subtyping)
132
1
7.3.2 Subclassing for Specification
132
1
7.3.3 Subclassing for Construction
133
1
7.3.4 Subclassing for Generalization
134
1
7.3.5 Subclassing for Extension
134
1
7.3.6 Subclassing for Limitation
134
1
7.3.7 Subclassing for Variance
135
1
7.3.8 Subclassing for Combination
135
1
7.3.9 Summary of the Forms of Inheritance
135
1
7.4 Inheritance in Various Languages
136
7
7.4.1 Inheritance in Object Pascal
137
1
7.4.2 Inheritance in Smalltalk
137
3
7.4.3 Inheritance in Objective-C
140
1
7.4.4 Inheritance in C++
140
1
7.4.5 Inheritance in Java
141
2
7.5 The Benefits of Inheritance
143
2
7.5.1 Software Reusability
143
1
7.5.2 Code Sharing
143
1
7.5.3 Consistency of Interface
144
1
7.5.4 Software Components
144
1
7.5.5 Rapid Prototyping
144
1
7.5.6 Polymorphism and Frameworks
144
1
7.5.7 Information Hiding
145
1
7.6 The Cost of Inheritance
145
4
7.6.1 Execution Speed
145
1
7.6.2 Program Size
145
1
7.6.3 Message-Passing Overhead
146
1
7.6.4 Program Complexity
146
3
8 A Case Study: Solitaire
149
20
8.1 The Class Card
149
2
8.2 Linked Lists
151
4
8.3 The Game
155
1
8.4 Card Piles-Inheritance in Action
156
9
8.4.1 The Suit Piles
159
1
8.4.2 The Deck Pile
159
1
8.4.3 The Discard Pile
160
1
8.4.4 The Tableau Piles
160
5
8.5 Playing the Polymorphic Game
165
2
8.6 Building a More Complete Game
167
2
9 Mechanisms for Software Reuse
169
10
9.1 Inheritance and Substitutability
169
1
9.1.1 The Is-a Rule and the Has-a Rule
170
1
9.2 Composition and Inheritance Described
170
5
9.2.1 Using Composition
171
2
9.2.2 Using Inheritance
173
1
9.2.3 Private Inheritance in C++
174
1
9.3 Composition and Inheritance Contrasted
175
2
9.4 Will Widespread Software Reuse Become Reality?
177
2
10 Subclasses and Subtypes
179
16
10.1 Issues in Binding and Message Lookup
180
2
10.1.1 Method Binding
180
1
10.1.2 The Reverse Polymorphism Problem
181
1
10.2 Binding in Programming Languages
182
9
10.2.1 Binding and Message Lookup in Object Pascal
182
2
10.2.2 Binding and Message Lookup in Smalltalk
184
1
10.2.3 Binding and Message Lookup in Objective-C
185
1
10.2.4 Binding and Message Lookup in C++
186
3
10.2.5 Binding and Message Lookup in Java
189
2
10.3 Merits of Static versus Dynamic Binding
191
4
11 Replacement and Refinement
195
18
11.1 Adding Replacing and Refining
195
1
11.1.1 American and Scandinavian Semanties
196
1
11.2 Replacement
196
1
11.2.1 Replacement and the Principle of Substitutability
197
1
11.2.2 Notating Replacement
198
1
11.3 Replacement in Various Languages
198
5
11.3.1 Replacement in C++
198
3
11.3.2 Replacement in Object Pascal
201
1
11.3.3 Replacement in Smalltalk and Objective-C
201
1
11.3.4 Replacement in Java
201
2
11.1 Refinement
203
5
11.4.1 Refinement in Simula and Beta
204
4
11.4.2 Wrappers in CLOS
208
1
11.5 Refinement in Various Languages
208
5
11.5.1 Refinement on Object Pascal
208
1
11.5.2 Refinement in C++
209
1
11.5.3 Refinement in Smalltalk, Java, and Objective-C
210
3
12 Implications of Inheritance
213
22
12.1 Memory Layout
213
6
12.1.1 Minimum Static Space Allocation
215
2
12.1.2 Maximum Static Space Allocation
217
1
12.1.3 Dynamic Memory Allocation
218
1
12.2 Assignment
219
5
12.2.1 Assignment in C++
220
2
12.2.2 Assignment in Object Pascal and Java
222
1
12.2.3 Assignment in Smalltalk
223
1
12.2.4 Assignment in Objective-C
223
1
12.3 Equality
224
6
12.3.1 Covariance and Contravariance
225
3
12.3.2 Equality in Objective-C, Java, and Object Pascal
228
1
12.3.3 Equality in Smalltalk
229
1
12.3.4 Equality in C++
229
1
12.4 Type Conversion
230
5
13 Multiple Inheritance
235
16
13.1 Incomparable Complex Numbers
235
3
13.2 Walking Menus
238
2
13.3 Name Ambiguity
240
3
13.3.1 Inheritance from Common Ancestors
241
2
13.4 Multiple Inheritance in C++
243
6
13.5 Multiple Inheritance in Java
249
2
14 Polymorphism
251
20
14.1 Polymorphism in Programming Languages
251
2
14.1.1 Polymorphic Functions in Dynamic Languages
251
1
14.1.2 Low-Level and High-Level Abstractions
252
1
14.2 Varieties of Polymorphism
253
1
14.3 Polymorphic Variables
254
1
14.4 Overloading
255
2
14.4.1 Overloading Names in Real Life
255
1
14.4.2 Overloading and Coercion
256
1
14.4.3 Overloading Does Not Imply Similarity
256
1
14.4.4 Parameteric Overloading
257
1
14.5 Overriding
257
2
14.5.1 Overriding in Class Magnitude
258
1
14.6 Deferred Methods
259
1
14.7 Pure Polymorphism
259
2
14.8 Generics and Templates
261
1
14.9 Polymorphism in the Various Languages
262
6
14.9.1 Polymorphism in C++
262
3
14.9.2 Polymorphism in Java
265
1
14.9.3 Polymorphism in Object Pascal
266
1
14.9.4 Polymorphism in Objective-C
267
1
14.9.5 Polymorphism in Smalltalk
268
1
14.10 Efficiency and Polymorphism
268
3
15 A Case Study: Container Classes
271
16
15.1 Using Conventional Techniques
271
3
15.2 Containers in Dynamic Languages
274
3
15.3 Containers in Strongly Typed Languages
277
3
15.4 Hiding the Cast with Subclassing
280
1
15.5 Parameterized Classes
281
6
15.5.1 Loops and Iteration in C++
283
4
16 A Case Study: The STL
287
14
16.1 Iterators
289
1
16.2 Function Objects
289
2
16.3 Example Program An Inventory System
291
2
16.4 Example Program Graphs
293
2
16.5 Example Program A Concordance
295
3
16.6 The Future of OOP
298
3
17 Visibility and Dependency
301
20
17.1 Coupling and Cohesion
302
6
17.1.1 Varieties of Coupling
302
1
17.1.2 Varieties of Cohesion
303
2
17.1.3 Coupling and Cohesion in Object-Oriented Systems
305
1
17.1.4 The Law of Demeter
305
2
17.1.5 Class-Level versus Object-Level Visibility
307
1
17.1.6 Active Values
307
1
17.2 Subclass Clients and User Clients
308
1
17.3 Control Of Access and Visibility
309
9
17.3.1 Visibility in Smalltalk
310
1
17.3.2 Visibility in Object Pascal
310
1
17.3.3 Visibility in C++
310
1
17.3.4 Visibility in Java
317
1
17.3.5 Visibility in Objective-C
318
1
17.4 Intentional Dependency
318
3
18 Patterns and Frameworks
321
12
18.1 Application Frameworks
321
4
18.1.1 The Java API
323
1
18.1.2 A Simulation Framework
324
1
18.2 Design Patterns
325
8
18.2.1 The Intermediary Pattern
326
1
18.2.2 Traversal Patterns
327
3
18.2.3 The Double-Dispatching Pattern
330
2
18.2.4 Classifying Design Patterns
332
1
19 A Case Study: The LAF
333
10
19.1 Components of a Graphical User Interface
333
1
19.2 Event-Driven Execution
334
1
19.3 Using Inheritance to Customize
335
1
19.4 Classes in the LAF
336
1
19.5 The Class application
336
5
19.5.1 The Class button
338
1
19.5.2 The Classes menu and menultem
339
2
19.6 Summary
341
2
20 A Second Look at Classes
343
20
20.1 Classes as Types
343
4
20.1.1 How Inheritance Complicates the View of Types
344
3
20.1.2 Inheritance and Storage
347
1
20.2 Classes as Objects
347
7
20.2.1 Object Creation Factories
348
1
20.2.2 The Class Class
348
2
20.2.3 Metaclasses and Class Methods
350
2
20.2.4 Object Initialization
352
1
20.2.5 Posing in Objective-C
352
2
20.3 Class Data
354
3
20.3.1 Class Variables in Smalltalk
355
1
20.3.2 Class Variables in C++
355
1
20.3.3 Class Variables in Java
356
1
20.3.4 Class Variables in Objective-C
357
1
20.4 Are Classes Necessary?
357
6
20.4.1 What is Knowledge?
357
1
20.4.2 Delegation
358
5
21 Implementation
363
14
21.1 Compilers and Interpreters
363
1
21.2 Compilers
364
8
21.2.1 The Slicing Problem
365
1
21.2.2 Matching Methods to Messages
366
1
21.2.3 Virtual Method Tables
366
2
21.2.4 Name Encoding
368
1
21.2.5 Dispatch Tables
369
3
21.3 Interpreters
372
5
A Source for the Eight-Queens Puzzle
377
14
A.1 Eight-Queens in Apple Object Pascal
377
3
A.2 Eight-Queens in C++
380
2
A.3 Eight-Queens in Java
382
3
A.3.1 HTML File for the Java Application
384
1
A.4 Eight-Queens in Objective-C
385
3
A.5 Eight-Queens in Smalltalk
388
3
B Source for the Billiards Game
391
16
B.1 The Version without Inhertiance
391
10
B.2 The Version with Inheritance
401
6
C Source for the Solitaire Game
407
8
Glossary
415
28
Index
443