Skip to content

Glossary: Software Design Patterns in Go

Factory method

A pattern where the code that uses a part lets something else decide which object to make. Because Go has no subclasses, a function field plays that role, as in `Shipment{makeCarrier: ...}`.

Where the book teaches it

Related terms

Simple factoryAbstract factory