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
4 - Design Patterns Basics
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
“There is one timeless way of building.”
Christopher AlexanderEssentials
Whereas code reuse played an important role in Part I of this text, design reuse plays an equally important role in Part II. The effort put into thinking abstractly about software structure and behavior pays off in high-level designs that prove useful independent of the application and implementation language. Patterns comprise reusable elements of successful designs.
The software community typically uses the terms “design patterns” and “object-oriented design patterns” interchangeably. This stems from the expressiveness of OOP languages in describing the relationships and interactions between ADTs. Patterns can improve a code's structure and readability and reduce its development costs by encouraging reuse.
Software design patterns comprise four elements (Gamma et al. 1995):
The pattern name: a handle that describes a design problem, its solution, and consequences in a word or two.
The problem: a description of when to apply the pattern and within what context.
The solution: the elements that constitute the design, the relationships between these elements, their responsibilities, and their collaborations.
The consequences: the results and trade-offs of applying the pattern.
Although there have been suggestions to include additional information in identifying a pattern, for example, sample code and known uses to validate the pattern as a proven solution, authors generally agree that elements 2-4 enumerate the three essential factors in each pattern.
- Type
- Chapter
- Information
- Scientific Software DesignThe Object-Oriented Way, pp. 85 - 106Publisher: Cambridge University PressPrint publication year: 2011