Bibliographic record and links to related information available from the Library of Congress catalog.
Note: Contents data are machine generated based on pre-publication provided by the publisher. Contents may have variations from the printed book or be incomplete or contain other coding.
Chapter 1: Elegance in Object-Oriented Design and Implementation Section 1.0 Introduction Section 1.1 Why worry? Section 1.2 Software Engineering Section 1.3 Criteria for elegant software Section 1.4 Roadmap This chapter lays the groundwork for the rest of the text. It motivates the study of object- oriented design and gives examples of software failures that could possibly have been prevented if the software had been designed better. It includes the properties that software should have in order to be called "elegant". It finishes with a summary of the contents of the other chapters in the text. Chapter 2: Fundamentals of Object Orientation Section 2.0 Introduction Section 2.1 Object-Oriented Programming vs. Non-Object- Oriented Programming Overview of OO vs. non-OO programming Object-Oriented languages Advantages of OO programming Section 2.2 Classes, Objects, Variables, and Methods in Java Section 2.3 Aside: Class methods & variables in Java Intro to class variables and methods Class variables and their uses Class methods and their uses Summary Section 2.4 Brief Introduction to UML Class diagrams Section 2.5 Implementation Inheritance Specialization The Object superclass in Java Another use of Specialization Generalization Single Inheritance in Java Section 2.6 Types, subtypes, and interface inheritance Type Polymorphism The value of polymorphism Section 2.7 Interfaces vs. abstract classes Section 2.8 Dynamic method invocation Section 2.9 Overloading vs. overriding Section 2.10 Controlling access to methods and data (public, private, protected, package) Section 2.11 Summary This chapter reviews the basics of object-oriented programming and the advantages that such programming can provide to the programmer and software designer for making the software more flexible, extendable, reusable, and scalable. Chapter 3: Elegance and Implementation Inheritance Section 3.0 Introduction Section 3.1 Four perspectives on inheritance Code reuse perspective Is-a perspective Public interface perspective Polymorphism perspective Section 3.2 Sufficiency of code reuse Section 3.3 Sufficiency of code reuse and the is-a relationship Section 3.4 Sufficiency of Code reuse, the is-a relationship, and public interfaces Section 3.5 Has-a relationships and UML associations Section 3.6 Sufficiency of code reuse, the is-a relationship, public interfaces, and polymorphism Section 3.7 Costs of using implementation inheritance Section 3.8 Example: Person, Woman, and Man Section 3.9 Example: Drawing polygons Section 3.10 Example: Sorting Section 3.11 Subclassing arrays in Java Section 3.12 Inheritance vs. referencing revisited Section 3.13 Summary This chapter expands on the material in the preceding chapter to discuss more thoroughly the role of inheritance in object-oriented software design, including its advantages and disadvantages, and to discuss alternatives to inheritance. Chapter 4: Elegance and Methods Section 4.0 Introduction Section 4.1 Coding Styles and Naming Conventions Section 4.2 Methods and decomposition Section 4.3 Cohesive Methods Section 4.4 Well-formed objects and class invariants Section 4.5 Internal documentation Section 4.6 External documentation Section 4.7 Case Study: Overriding the equals method in Java Section 4.8 Case Study: Overriding the clone method in Java Section 4.9 Refactoring Section 4.10 Code Optimization Section 4.11 Summary and Further Reading This chapter looks at issues concerning low-level code, such as readability, modifiability, and reusability. In this chapter, we assume that the classes and their desired behaviors have already been mapped out and only the implementation of those behaviors remains to be done. Chapter 5: Elegance and Classes Section 5.0 Introduction Section 5.1 Starting out finding classes and their relationships Extract nouns and verbs Use Concepts from the application domain Use CRC cards Class protocols The big picture Section 5.2 Maximizing Cohesion Section 5.3 Separation of Responsibility Section 5.4 Duplication avoidance Section 5.5 Complete and consistent protocols Section 5.6 Mutability vs. Immutability Revisited Section 5.7 Designing for change Section 5.8 Law of Demeter Section 5.8 Summary and Further Reading This chapter looks at object-oriented software development at a higher level. We discuss how to design classes to solve particular problems. That is, we discuss general principles to follow when deciding what classes to create, what their behavior will be, and with what other objects they will communicate. Chapter 6: Simple Case Study of a Money Class Section 6.0 Introduction Section 6.1 Naive representations of money Section 6.2 A USMoney class Section 6.3 Using subclasses of Money to represent different currencies Section 6.4 Using one class of Money with a currency attribute Section 6.5 Mixed currencies vs. simple currencies Section 6.6 Converting between currencies Section 6.7 MoneyConverter Issues Section 6.8 MixedMoney and SimpleMoney issues Section 6.9 Mixed Money only Section 6.10 Alternate Implementation with binary trees Section 6.11 Summary This chapter is a small case study. It introduces several implementations of money, each a refinement of the preceding one. Chapter 7: Introduction to Design Patterns Section 7.0 Introduction Section 7.1 The Adapter pattern Section 7.2 The Singleton pattern Section 7.3 The Iterator pattern Section 7.4 The Command Pattern Section 7.5 Factories Section 7.6 Summary This chapter introduces the reader to the topic of design patterns. We present four simple patterns as samples. The discussion of each pattern includes examples from earlier chapters of the book where the pattern was used but not explicitly stated. The succeeding chapters in the text introduce more design patterns in the contexts of their case studies. Chapter 8: Figure-Drawing Application Case Study Section 8.0 Introduction Section 8.1 The User interface Section 8.2 The Observer pattern Section 8.3 The Figure hierarchy Section 8.4 The Model-View-Controller architecture Section 8.5 The Prototype pattern Section 8.6 The State pattern Section 8.7 The Composite pattern Section 8.8 The Memento pattern Section 8.9 Summary This chapter gives a case study of a drawing application. We start with a very simple application and in each section we add enhancements to it, which provides us with a context in which to introduce more design patterns and to use the design principles discussed earlier in the text. The sections include the discussion of several alternative designs and implementations of the application and their advantages and disadvantages. Chapter 9: Language Parser Case Study Section 9.0 Introduction Section 9.1 VSSJ: A very simple subset of Java Section 9.2 Pretty printing Section 9.3 Scanning Section 9.4 A simple pretty printer Section 9.5 Interpreter Pattern Section 9.6 Design of the AST Section 9.7 Method Finder Section 9.8 Some Problems with these "elegant" implementations Section 9.9 The Visitor pattern Section 9.10 Visitors and double-dispatching Section 9.11 Fa¿ade pattern Section 9.12 Parsers and Builders Section 9.13 Tokens, visitors, and polymorphism (optional section) Section 9.14 Summary This chapter gives a case study of code manipulators for a subset of the Java language, which provides us with a context in which to introduce more design patterns. Appendix A: An Introduction to UML Section A.0 Introduction Section A.1 Class diagrams Section A.2 Sequence diagrams Section A.3 State machine diagrams Section A.4 Use case diagrams Section A.5 Summary This appendix explains how to understand and use the four UML diagrams that appear in this text. Appendix B: Coding conventions and Javadoc comments Section B.0 Introduction Section B.1 Indentation and spacing Section B.2 Punctuation and layout Section B.3 Formatting a loop Section B.4 Incrementing integer variables Section B.5 Working with boolean variables Section B.6 Line and block comments Section B.7 File layout Section B.8 Javadoc syntax Section B.9 Summary This appendix covers some of the material in Sun?s coding conventions for Java. It covers Javadoc comments in quite a bit of detail.
Library of Congress Subject Headings for this publication:
Object-oriented programming (Computer science).
Java (Computer program language).