Skip to content

Glossary: Software Design Patterns in Go

Simple factory

Also written: factory, factories

One function that knows every type and returns the right one for a name. `createCarrier("ups")` looks the name up in a map of maker functions and returns a ready carrier, or an error for an unknown name.

Where the book teaches it

Related terms

Factory methodAbstract factoryRegistry