DEV Community

loading...

Discussion on: Explain Factory Pattern Like I'm Five

Collapse
jamesmh profile image
James Hickey

You want to rent a vehicle. Your options are "small", "mid-size", "suv".

You ask to rent a "suv".

All you know is - you got an suv. But in reality, it could be a ford, gm, etc.

But you don't care. You just want some generic "suv".

The rental dealer is like a factory. You ask for something generic. They give you something real.