You are previewing Object-Oriented Computation in C++ and Java: A Practical Guide to Design Patterns for Object-Oriented Computing.
O'Reilly logo
Object-Oriented Computation in C++ and Java: A Practical Guide to Design Patterns for Object-Oriented Computing

Book Description

This is the digital version of the printed book (Copyright 2007).

Virtually all business, scientific, and engineering applications are heavily reliant on numeric data items. C++ and Java offer object-oriented programmers unique flexibility and control over the computations required within such applications.

However, most books on object-oriented programming gloss over such numeric data items, emphasizing instead one-dimensional containers or collections and components of the graphical user interface.

Object-Oriented Computation in C++ and Java
fills the gap left by such books.

Drawing on more than twenty years' experience as a software developer, tester, consultant, and professor, Conrad Weisert shows readers how to use numeric objects effectively.

Not limited to any language or methodology, the concepts and techniques discussed in this book are entirely independent of one's choice of design and coding methodology.

Practitioners of Extreme Programming, UML-driven design, agile methods, incremental development, and so on will all develop these same data classes.

Whether you are a seasoned professional or an advanced computer science student, this book can teach you techniques that will improve the quality of your programming and the efficiency of your applications. The exercises (and answers) presented in this book with teach you new ways to implement the computational power of C++, Java, and numeric data items.

Topics include

taxonomy of data types
developing and using object-oriented classes for numeric data
design patterns for commonly occurring numeric data types
families of interacting numeric data types
choosing efficient and flexible internal data representations
techniques for exploiting pattern reuse in C++
conventions for arithmetic operations in Java
numeric vectors and matrices

Table of Contents

  1. About This eBook
  2. Title Page
  3. Copyright Page
  4. Also Available from Dorset House Publishing
  5. Acknowledgments
  6. Contents
  7. Preface
  8. Introduction
    1. I.1. Your background
    2. I.2. Reading guide
    3. I.3. Methodology independence
    4. I.4. Choice of language
  9. 1. Numeric Objects in Context
    1. 1.1. Data and objects
    2. 1.2. Application-domain data
    3. 1.3. Non-application-domain data
    4. 1.4. Four basic types of elementary data
    5. 1.5. Avoiding false composites
    6. 1.6. Numeric data representation
  10. 2. Review of C++ and Java Facilities and Techniques for Defining Classes
    1. 2.1. Our emphasis
    2. 2.2. The basic goal—a major difference between C++ and Java
    3. 2.3. Constructors and destructor
    4. 2.4. Operator overloading in C++
    5. 2.5. Operator overloading in Java
    6. 2.6. Flow-control constructs
    7. 2.7. Manipulating character strings in C++
    8. 2.8. Canonical class structure
    9. 2.9. Overcoming macrophobia
    10. 2.10. Program readability
    11. 2.11. Error detection and exceptions
  11. 3. Defining a Pure Numeric Data Type
    1. 3.1. What does “pure numeric” mean?
    2. 3.2. Example: Designing a Complex number class
    3. 3.3. Packaging and using the Complex class
    4. 3.4. Some other pure numeric classes
    5. 3.5. Java equivalents
  12. 4. Defining a Numeric Type Having an Additive Unit of Measure
    1. 4.1. Unit of measure in modeling real-world data
    2. 4.2. A business application example: Money class
    3. 4.3. Noting the additive pattern
    4. 4.4. Supporting an external Money representation
    5. 4.5. More additive classes
    6. 4.6. Additive classes in Java
  13. 5. The Point-Extent Pattern for Pairs of Numeric Types
    1. 5.1. Non-additive numeric types
    2. 5.2. Another companion class: CalendarInfo
    3. 5.3. Back to Date and Days
    4. 5.4. Other Point-Extent pairs
    5. 5.5. Date and Days classes in Java
    6. 5.6. Other point-extent classes in Java
  14. 6. Families of Interacting Numeric Types
    1. 6.1. Beyond the patterns
    2. 6.2. Example: Electrical circuit quantities
    3. 6.3. Greater interaction: Newton’s laws in a straight line
    4. 6.4. Extending Newtonian classes to three-dimensional space
    5. 6.5. Other families of interacting types
    6. 6.6. Summary
    7. 6.7. Java versions
  15. 7. Role of Inheritance and Polymorphism with Numeric Types
    1. 7.1. Review of example classes
    2. 7.2. Representation is not specialization
    3. 7.3. Usage is not specialization
    4. 7.4. A numeric specialization example
    5. 7.5. Obstacles to polymorphic functions
    6. 7.6. Turning off Java polymorphism
    7. 7.7. Why bother with OOP?
  16. 8. Programming with Numeric Vectors and Matrices
    1. 8.1. Introduction
    2. 8.2. Existing facilities
    3. 8.3. A C++ base class for all arrays
    4. 8.4. Some specialized vector classes
    5. 8.5. Operations on numeric arrays
    6. 8.6. A basic Matrix class
    7. 8.7. Some specialized Matrix classes
    8. 8.8. What about Java?
  17. Appendix: Answers to Selected Exercises
  18. Index