Golden Hammer

noun

say it: “GOHL-dun HAM-er” /ˈɡoʊldən ˈhæmər/

Using one favorite tool or pattern for every problem, whether it fits or not.

What is a golden hammer?

A golden hammer is the anti-pattern of using one favorite tool for every job: every rule a Strategy, every shared thing a Singleton, every problem solved the way the last one was. It comes from the saying "when all you have is a hammer, everything looks like a nail". The better answer is to choose the tool from the problem, by asking what change each choice makes easy.

In a sentence

  • “Turning every if into a strategy class was a golden hammer.”

Level: Journeyman · More Software Development terms at this level

Updated