# Factory Pattern

*noun*

say it: **“FAK-tuh-ree PAT-ern”** **/ˈfæktəri ˈpætərn/**

A design pattern that puts object creation in one place, so callers don't choose the class themselves.

## What is **Factory Pattern**?

The **Factory pattern** puts object creation in one place. Callers ask the factory for "a notification for SMS" and get the right object back without knowing which class it is.

```csharp
public static class NotificationFactory
{
    public static INotification Create(string channel) => channel switch
    {
        "email" => new EmailNotification(),
        "sms"   => new SmsNotification(),
        _       => throw new ArgumentException($"Unknown channel {channel}")
    };
}
```

## In a sentence

- “A **factory** decides whether a notification becomes an email or a text message.”

Level: Freelancer · [More OOP terms at this level](https://www.ask-codey.com/glossary?category=oop&level=4)

Updated: November 9, 2026

Source: https://www.ask-codey.com/glossary/factory-pattern
