Object-Oriented Programming

Factory Pattern

English

Overview

A design pattern that delegates instance creation to a dedicated class.

Details

A design pattern that consolidates object-creation logic into a dedicated class (a factory), hiding the details of creation from the caller. Because it decouples the caller from the concrete type being created, swapping in a mock for testing is easier than scattering 'new' calls directly through the code.

More Programming terms