Factory Pattern
Also known as factory function · object factory · factory method
A creational design approach that puts object creation behind a function or abstraction so callers need not choose or construct concrete implementations directly.
In the real world
createStorage('memory') returns an in-memory store, while createStorage('disk') returns a disk-backed store with the same interface.