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
8 - The Puppeteer 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
“Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic.”
Miss PiggyThe Problem
While the abstract calculus and strategy patterns apply to the integration of a single physics abstraction, our chief concern lies in linking multiple abstractions. This poses at least two significant software design problems. The first involves how to facilitate interabstraction communication. The GoF addressed interabstraction communication with the mediator pattern. When N objects interact, a software architect can reduce the N(N−1)+ associations between the objects to 2N associations by employing a mediator.
The mediator association count stems from the requirements that the Mediator know each communicating party and those parties know the Mediator. For example, in a mediator implementation presented by Gamma et al. (1995), the sender passes a reference to itself to the mediator. The sender must be aware of the mediator in order to know where to send the message. Likewise, the mediator must be aware of the sender in order to invoke methods on the sender via the passed reference. Figure 8.1 illustrates the associations in an atmospheric boundary layer model, wherein the air, ground, and cloud ADTs might solve equation sets for the airflow, ground transpiration, and discrete droplet motion, respectively.
A second and conceptually more challenging problem concerns how one assembles quantities of an inherently global nature – that is, information that can only be determined with simultaneous knowledge of the implementation details of each of the single-physics abstractions.
- Type
- Chapter
- Information
- Scientific Software DesignThe Object-Oriented Way, pp. 167 - 201Publisher: Cambridge University PressPrint publication year: 2011