Book contents
- Frontmatter
- Contents
- List of Figures
- List of Tables
- Preface
- Acknowledgments
- Disclaimer
- PART I THE TAO OF SCIENTIFIC OOP
- PART II SOOP TO NUTS AND BOLTS
- 4 Design Patterns Basics
- 5 The Object Pattern
- 6 The Abstract Calculus Pattern
- 7 The Strategy and Surrogate Patterns
- 8 The Puppeteer Pattern
- 9 Factory Patterns
- PART III GUMBO SOOP
- Appendix A Mathematical Background
- Appendix B Unified Modeling Language Elements
- Bibliography
- Index
6 - The Abstract Calculus Pattern
from PART II - SOOP TO NUTS AND BOLTS
Published online by Cambridge University Press: 01 June 2011
- Frontmatter
- Contents
- List of Figures
- List of Tables
- Preface
- Acknowledgments
- Disclaimer
- PART I THE TAO OF SCIENTIFIC OOP
- PART II SOOP TO NUTS AND BOLTS
- 4 Design Patterns Basics
- 5 The Object Pattern
- 6 The Abstract Calculus Pattern
- 7 The Strategy and Surrogate Patterns
- 8 The Puppeteer Pattern
- 9 Factory Patterns
- PART III GUMBO SOOP
- Appendix A Mathematical Background
- Appendix B Unified Modeling Language Elements
- Bibliography
- Index
Summary
“All professions are conspiracies against the laity.”
George Bernard ShawThe Problem
The context of abstract calculus is the construction of numerical software that approximates various differential and integral forms. Two pairs of conflicting forces arise in this context. In the first pair, the low-level nature of the mathematical constructs provided by mainstream programming languages constrains the design of most scientific programs. A desire for syntax and semantics that naturally represents the much richer mathematical language of scientists and engineers opposes this constraint.
The C++ language contains native scalar and one-dimensional array variables. The C++ STL extends these in vectors with nice properties such as automatic memory management, including sizing and resizing upon assignment. Fortran 2003 provides similar capabilities with its multidimensional allocatable array construct. It also provides numerous useful intrinsic procedures for determining array properties including size, shape, maximum element, and minimum element, as well as intrinsic procedures and operators for combining arrays into sums, matrix vector products, and other derived information. It is common in scientific and engineering work to build up from these native constructs a set of array classes with a variety of additionally useful methods (Barton and Nackman 1994; Heroux et al. 2005). Nonetheless, the resulting objects model very low-level mathematical entities in the sense that one typically arrives at these entities after fairly involved derivations from, and approximations to, much higher-level constructs.
- Type
- Chapter
- Information
- Scientific Software DesignThe Object-Oriented Way, pp. 129 - 142Publisher: Cambridge University PressPrint publication year: 2011