Abstract
This chapter covers two GoF patterns: Factory Method and Abstract Factory. These patterns are closely related, so we discuss them together. The truth, though, is that the real design pattern is called Factory and that both Factory Method and Abstract Factory are simply variations that are important, but certainly not as important as the main thing.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Some programming languages, most notably Objective-C and Swift, do allow overloading of functions that only differ by parameter names. Unfortunately, this idea results in a viral propagation of parameter names in all calls. I still prefer positional parameters most of the time.
- 2.
Whenever you want to prevent a client from accessing something, I always recommend you make it protected rather than private because then you make the class inheritance-friendly.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2019 Dmitri Nesteruk
About this chapter
Cite this chapter
Nesteruk, D. (2019). Factories. In: Design Patterns in .NET. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4366-4_4
Download citation
DOI: https://doi.org/10.1007/978-1-4842-4366-4_4
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-4365-7
Online ISBN: 978-1-4842-4366-4
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)