An Introduction To Object-Oriented Programming, 3rd Edition PDF by Timothy A Budd

By

An Introduction To Object-Oriented Programming, Third Edition

By Timothy A. Budd

An Introduction To Object-Oriented Programming, 3rd Edition PDF by Timothy A Budd

Contents:

Preface

1 ⊡ Thinking Object-Oriented

1.1 Why Is OOP Popular?

1.2 Language and Thought

1.2.1 Eskimos and snow

1.2.2 An example from computer languages

1.2.3 Church’s conjecture and the Whorf hypothesis

1.3 A New Paradigm

1.4 A Way of Viewing the World

1.4.1 Agents and communities

1.4.2 Messages and methods

1.4.3 Responsibilities

1.4.4 Classes and instances

1.4.5 Class hierarchies—inheritance

1.4.6 Method binding and overriding

1.4.7 Summary of object-oriented concepts

1.5 Computation as Simulation

1.5.1 The power of metaphor

1.5.2 Avoiding infinite regression

1.6 A Brief History

Summary

Further Reading

Self-Study Questions

Exercises

2 ⊡ Abstraction

2.1 Layers of Abstraction

2.2 Other Forms of Abstraction

2.2.1 Division into parts

2.2.2 Encapsulation and interchangeability

2.2.3 Interface and implementation

2.2.4 The service view

2.2.5 Composition

2.2.6 Layers of specialization

2.2.7 Patterns

2.3 A Short History of Abstraction Mechanisms

2.3.1 Assembly language

2.3.2 Procedures

2.3.3 Modules

2.3.4 Abstract data types

2.3.5 A service-centered view

2.3.6 Messages, inheritance, and polymorphism

Summary

Further Information

Self-Study Questions

Exercises

3 ⊡ Object-Oriented Design

3.1 Responsibility Implies Noninterference

3.2 Programming in the Small and in the Large

3.3 Why Begin with Behavior?

3.4 A Case Study in RDD

3.4.1 The Interactive Intelligent Kitchen Helper

3.4.2 Working through scenarios

3.4.3 Identification of components

3.5 CRC Cards—Recording Responsibility

3.5.1 Give components a physical representation

3.5.2 The what/who cycle

3.5.3 Documentation

3.6 Components and Behavior

3.6.1 Postponing decisions

3.6.2 Preparing for change

3.6.3 Continuing the scenario

3.6.4 Interaction diagrams

3.7 Software Components

3.7.1 Behavior and state

3.7.2 Instances and classes

3.7.3 Coupling and cohesion

3.7.4 Interface and implementation—Parnas’s principles

3.8 Formalize the Interface

3.8.1 Coming up with names

3.9 Designing the Representation

3.10 Implementing Components

3.11 Integration of Components

3.12 Maintenance and Evolution

Summary

Further Reading

Self-Study Questions

Exercises

4 ⊡ Classes and Methods

4.1 Encapsulation

4.2 Class Definitions

4.2.1 C++, Java, and C#

4.2.2 Apple Object Pascal and Delphi Pascal

4.2.3 Smalltalk

4.2.4 Other languages

4.3 Methods

4.3.1 Order of methods in a class declaration

4.3.2 Constant or immutable data fields

4.3.3 Separating definition and implementation

4.4 Variations on Class Themes

4.4.1 Methods without classes in Oberon

4.4.2 Interfaces

4.4.3 Properties

4.4.4 Forward definitions

4.4.5 Inner or nested classes

4.4.6 Class data fields

4.4.7 Classes as objects

Summary

Further Reading

Self-Study Questions

Exercises

5 ⊡ Messages, Instances, and Initialization

5.1 Message-Passing Syntax

5.2 Statically and Dynamically Typed Languages

5.3 Accessing the Receiver from within a Method

5.4 Object Creation

5.4.1 Creation of arrays of objects

5.5 Pointers and Memory Allocation

5.5.1 Memory recovery

5.6 Constructors

5.6.1 The orthodox canonical class form

5.6.2 Constant values

5.7 Destructors and Finalizers

5.8 Metaclasses in Smalltalk

Summary

Further Reading

Self-Study Questions

Exercises

6 ⊡ A Case Study: The Eight-Queens Puzzle

6.1 The Eight-Queens Puzzle

6.1.1 Creating objects that find their own solution

6.2 Using Generators

6.2.1 Initialization

6.2.2 Finding a solution

6.2.3 Advancing to the next position

6.3 The Eight-Queens Puzzle in Several Languages

6.3.1 The eight-queens puzzle in Object Pascal

6.3.2 The eight-queens puzzle in C++

6.3.3 The eight-queens puzzle in Java

6.3.4 The eight-queens puzzle in Objective-C

6.3.5 The eight-queens puzzle in Smalltalk

6.3.6 The eight-queens puzzle in Ruby

Summary

Further Reading

Self-Study Questions

Exercises

7 ⊡ A Case Study: A Billiards Game

7.1 The Elements of Billiards

7.2 Graphical Objects

7.2.1 The wall graphical object

7.2.2 The hole graphical object

7.2.3 The ball graphical object

7.3 The Main Program

7.4 Using Inheritance

Summary

Further Information

Self-Study Questions

Exercises

8 ⊡ Inheritance and Substitution

8.1 An Intuitive Description of Inheritance

8.1.1 The is-a test

8.1.2 Reasons to use inheritance

8.2 Inheritance in Various Languages

8.3 Subclass, Subtype, and Substitution

8.3.1 Substitution and strong typing

8.4 Overriding and Virtual Methods

8.5 Interfaces and Abstract Classes

8.6 Forms of Inheritance

8.6.1 Subclassing for specialization (subtyping)

8.6.2 Subclassing for specification

8.6.3 Subclassing for construction

8.6.4 Subclassing for generalization

8.6.5 Subclassing for extension

8.6.6 Subclassing for limitation

8.6.7 Subclassing for variance

8.6.8 Subclassing for combination

8.6.9 Summary of the forms of inheritance

8.7 Variations on Inheritance

8.7.1 Anonymous classes in Java

8.7.2 Inheritance and constructors

8.7.3 Virtual destructors

8.8 The Benefits of Inheritance

8.8.1 Software reusability

8.8.2 Code sharing

8.8.3 Consistency of interface

8.8.4 Software components

8.8.5 Rapid prototyping

8.8.6 Polymorphism and frameworks

8.8.7 Information hiding

8.9 The Costs of Inheritance

8.9.1 Execution speed

8.9.2 Program size

8.9.3 Message-passing overhead

8.9.4 Program complexity

Summary

Further Reading

Self-Study Questions

Exercises

9 ⊡ A Case Study—A Card Game

9.1 The Class PlayingCard

9.2 Data and View Classes

9.3 The Game

9.4 Card Piles—Inheritance in Action

9.4.1 The default card pile

9.4.2 The suit piles

9.4.3 The deck pile

9.4.4 The discard pile

9.4.5 The tableau piles

9.5 Playing the Polymorphic Game

9.6 The Graphical User Interface

Summary

Further Reading

Self-Study Questions

Exercises

10 ⊡ Subclasses and Subtypes

10.1 Substitutability

10.2 Subtypes

10.3 The Substitutability Paradox

10.3.1 Is this a problem?

10.4 Subclassing for Construction

10.4.1 Private inheritance in C++

10.5 Dynamically Typed Languages

10.6 Pre- and Postconditions

10.7 Refinement Semantics

Summary

Further Reading

Self-Study Questions

Exercises

11 ⊡ Static and Dynamic Behavior

11.1 Static versus Dynamic Typing

11.2 Static and Dynamic Classes

11.2.1 Run-time type determination

11.2.2 Down casting (reverse polymorphism)

11.2.3 Run-time testing without language support

11.2.4 Testing message understanding

11.3 Static versus Dynamic Method Binding

Summary

Further Reading

Self-Study Questions

Exercises

12 ⊡ Implications of Substitution

12.1 Memory Layout

12.1.1 Minimum static space allocation

12.1.2 Maximum static space allocation

12.1.3 Dynamic memory allocation

12.2 Assignment

12.2.1 Assignment in C++

12.3 Copies and Clones

12.3.1 Copies in Smalltalk and Objective-C

12.3.2 Copy constructors in C++

12.3.3 Cloning in Java

12.4 Equality

12.4.1 Equality and identity

12.4.2 The paradoxes of equality testing

Summary

Further Reading

Self-Study Questions

Exercises

13 ⊡ Multiple Inheritance

13.1 Inheritance as Categorization

13.1.1 Incomparable complex numbers

13.2 Problems Arising from Multiple Inheritance

13.2.1 Name ambiguity

13.2.2 Impact on substitutability

13.2.3 Redefinition in Eiffel

13.2.4 Resolution by class ordering in CLOS

13.3 Multiple Inheritance of Interfaces

13.3.1 Mixins in CLOS

13.4 Inheritance from Common Ancestors

13.4.1 Constructors and multiple inheritance

13.5 Inner Classes

Summary

Further Reading

Self-Study Questions

Exercises

14 ⊡ Polymorphism and Software Reuse

14.1 Polymorphism in Programming Languages

14.1.1 Many tools, one goal

14.2 Mechanisms for Software Reuse

14.2.1 Using composition

14.2.2 Using inheritance

14.2.3 Composition and inheritance contrasted

14.3 Efficiency and Polymorphism

14.4 Will Widespread Software Reuse Become Reality?

Summary

Further Information

Self-Study Questions

Exercises

15 ⊡ Overloading

15.1 Type Signatures and Scopes

15.2 Overloading Based on Scopes

15.3 Overloading Based on Type Signatures

15.3.1 Coercion and conversion

15.4 Redefinition

15.5 Polyadicity

15.5.1 Optional parameters

15.6 Multi-Methods

15.6.1 Overloading Based on Values

Summary

14 ⊡ Polymorphism and Software Reuse

14.1 Polymorphism in Programming Languages

14.1.1 Many tools, one goal

14.2 Mechanisms for Software Reuse

14.2.1 Using composition

14.2.2 Using inheritance

14.2.3 Composition and inheritance contrasted

14.3 Efficiency and Polymorphism

14.4 Will Widespread Software Reuse Become Reality?

Summary

Further Information

Self-Study Questions

Exercises

15 ⊡ Overloading

15.1 Type Signatures and Scopes

15.2 Overloading Based on Scopes

15.3 Overloading Based on Type Signatures

15.3.1 Coercion and conversion

15.4 Redefinition

15.5 Polyadicity

15.5.1 Optional parameters

15.6 Multi-Methods

15.6.1 Overloading Based on Values

Summary

17.2.2 Endpoint comparisons in Smalltalk

17.2.3 Self and super

17.3 Downcasting

17.4 Pure Polymorphism

Summary

Further Information

Self-Study Questions

Exercises

18 ⊡ Generics

18.1 Template Functions

18.2 Template Classes

18.2.1 Bounded genericity

18.3 Inheritance in Template Arguments

18.3.1 Inheritance and arrays

18.4 Case Study—Combining Separate Classes

Summary

Further Reading

Self-Study Questions

Exercises

19 ⊡ Container Classes

19.1 Containers in Dynamically Typed Languages

19.1.1 Containers in Smalltalk-80

19.2 Containers in Statically Typed Languages

19.2.1 The tension between typing and reuse

19.2.2 Substitution and downcasting

19.2.3 Using substitution and overriding

19.2.4 Parameterized classes

19.3 Restricting Element Types

19.4 Element Traversal

19.4.1 Iterator loops

19.4.2 The visitor approach

Summary

Further Reading

Self-Study Questions

Exercises

20 ⊡ A Case Study: The STL

20.1 Iterators

20.2 Function Objects

20.3 Example Program—An Inventory System

20.4 Example Program—Graphs

20.4.1 Shortest path algorithm

20.4.2 Developing the data structures

20.5 A Concordance

20.6 The Future of OOP

Summary

Further Reading

Self-Study Questions

Exercises

21 ⊡ Frameworks

21.1 Reuse and Specialization

21.1.1 High- and low-level abstractions

21.1.2 An upside-down library

21.2 Example Frameworks

21.2.1 The Java Applet API

21.2.2 A Simulation Framework

21.2.3 An event-driven simulation framework

Summary

Further Reading

Self-Study Questions

Exercises

22 ⊡ An Example Framework: The AWT and Swing

22.1 The AWT Class Hierarchy

22.2 The Layout Manager

22.3 Listeners

22.3.1 Adapter classes

22.4 User Interface Components

22.5 Case Study: A Color Display

22.6 The Swing Component Library

22.6.1 Import libraries

22.6.2 Different components

22.6.3 Different paint protocol

22.6.4 Adding components to a window

Summary

Further Reading

Self-Study Questions

Exercises

23 ⊡ Object Interconnections

23.1 Coupling and Cohesion

23.1.1 Varieties of coupling

23.1.2 Varieties of cohesion

23.1.3 The Law of Demeter

23.1.4 Class-level versus object-level visibility

23.1.5 Active values

23.2 Subclass Clients and User Clients

23.3 Control of Access and Visibility

23.3.1 Visibility in Smalltalk

23.3.2 Visibility in Object Pascal

23.3.3 Visibility in C++

23.3.4 Visibility in Java

23.3.5 Visibility in Objective-C

23.4 Intentional Dependency

Summary

Further Reading

Self-Study Questions

Exercises

24 ⊡ Design Patterns

24.1 Controlling Information Flow

24.2 Describing Patterns

24.3 Iterator

24.4 Software Factory

24.5 Strategy

24.6 Singleton

24.7 Composite

24.8 Decorator

24.9 The Double-Dispatching Pattern

24.10 Flyweight

24.11 Proxy

24.12 Facade

24.13 Observer

Summary

Further Reading

Self-Study Questions

Exercises

25 ⊡ Reflection and Introspection

25.1 Mechanisms for Understanding

25.1.1 Class objects

25.1.2 The class name as string

25.1.3 Testing the class of an object

25.1.4 Creating an instance from a class

25.1.5 Testing if an object understands a message

25.1.6 Class behavior

25.2 Methods as Objects

25.3 Mechanisms for Modification

25.3.1 Method editing in Smalltalk

25.3.2 Dynamic class loading in Java

25.4 Metaclasses

Summary

Further Reading

Self-Study Questions

26 ⊡ Distributed Objects

26.1 Addresses, Ports, and Sockets

26.2 A Simple Client/Server Program

26.3 Multiple Clients

26.4 Transmitting Objects over a Network

26.5 Providing More Complexity

Summary

Further Reading

Self-Study Questions

Exercises

27 ⊡ Implementation

27.1 Compilers and Interpreters

27.2 The Receiver as Argument

27.3 Inherited Methods

27.3.1 The problem of multiple inheritance

27.3.2 The slicing problem

27.4 Overridden Methods

27.4.1 Eliminating virtual calls and in-lining

27.5 Name Encoding

27.6 Dispatch Tables

27.6.1 A method cache

27.7 Bytecode Interpreters

27.8 Just-in-Time Compilation

Summary

Further Reading

Self-Study Questions

Exercises

A ⊡ Source for the Eight-Queens Puzzle

A.1 Eight-Queens in Apple Object Pascal

A.2 Eight-Queens in C++

A.3 Eight-Queens in Java

A.4 Eight-Queens in Objective-C

A.5 Eight-Queens in Ruby

A.6 Eight-Queens in Smalltalk

B ⊡ Source for the Billiards Game

B.1 The Version without Inheritance

B.2 The Version with Inheritance

C ⊡ Source for the Solitaire Game

Glossary

References

Index

This book is US$10. Order for this book:
(Request for free sample pages click on "Order Now" button)

Book Order
Or, Send email: [email protected]

Share this Book!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.