© Vaskaran Sarcar 2020
V. SarcarDesign Patterns in C#https://doi.org/10.1007/978-1-4842-6062-3_24

24. Simple Factory Pattern

Vaskaran Sarcar1 
(1)
Garia, Kolkata, West Bengal, India
 

This chapter covers the Simple Factory pattern.

Definition

The Simple Factory pattern creates an object without exposing the instantiation logic to the client.

Concept

In object-oriented programming (OOP), a factory is such an object that can create other objects. A factory can be invoked in many ways, but most often, it uses a method that can return objects with varying prototypes. Any subroutine that helps create these new objects is considered a factory. Most importantly, it helps you abstract the process of object creation from the consumers of the application.

Real-World ...

Get Design Patterns in C#: A Hands-on Guide with Real-world Examples now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.