© Vaskaran Sarcar 2018
V. SarcarDesign Patterns in C#https://doi.org/10.1007/978-1-4842-3640-6_24

24. Simple Factory Pattern

Vaskaran Sarcar1  
(1)
Whitefield, Bangalore, Karnataka, India
 

This chapter covers the Simple Factory pattern.

Definition

Create an object without exposing the instantiation logic to the client.

Concept

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

Real-Life ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.