# Factory Pattern

A pattern that puts object creation in one place so callers don't pick the class.

## 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}")
    };
}
```

Level: Freelancer · [More OOP terms at this level](https://www.ask-codey.com/glossary/subjects/oop/freelancer)

Updated: September 27, 2026

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