Skip to main content

Factories

  • Chapter
  • First Online:
Design Patterns in .NET
  • 1633 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 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. 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

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Dmitri Nesteruk

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

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

Publish with us

Policies and ethics