13

From Programmer Q&A website, I came across the following line, which was a reply/answer to the question Design Patterns: Should I learn them?:

It depends on how disciplined you are as to whether you will apply the patterns once learned correctly, and not go nuts like the proverbial man with a hammer

What does "proverbial man with a hammer" mean in this context? Is it an idiom?

1
  • LOL just because I CAN cut wood with a hammer does not mean I should if better tools exist. As a software engineer, I see lots of "hammers" cutting "wood" because it is comfortable Commented Jul 28, 2011 at 14:39

2 Answers 2

26

Proverbial means “referred to in a proverb or idiom”. The proverb referred to here is “To a man with a hammer, everything looks like a nail” (variants include “He that is good with a hammer tends to think everything is a nail”). The overall meaning is you should not get so fond of a given tool (programming language, or pattern) that you use it exclusively, regardless of whether it is fit for the job at hand.

4
  • What do you mean by so kind of? Do you mean so fond of?
    – TRiG
    Commented Jul 28, 2011 at 15:45
  • @TRiG: sorry about that, I think I could have used “keen on” or “fond off”, and just ended up mixing them :)
    – F'x
    Commented Jul 28, 2011 at 15:47
  • Ah, keen on. I like that phrase. I must add it to my active vocabulary. (I gave you a +1 anyway, because your meaning was clear even before the edit.)
    – TRiG
    Commented Jul 28, 2011 at 15:55
  • @F'x -- after reading the referenced Q&A, I think that the hammer / nail analogy is correct -- but in this case, the caution was not to misuse design patterns -- after you understand one really well, you might be tempted to use (misuse) it in situations that it does not apply. Essentially, the design pattern becomes your hammer, and you may be tempted to use it even when you should not. I have observed the reverse phenomena as well -- once every problem looks like a nail, you start to use every tool like a hammer.
    – Jay Elston
    Commented Jul 28, 2011 at 23:43
7

There are various claimed sources of the original quote, but wikipedia attributes it to Abraham Maslow in The Psychology of Science.

It is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail

A related idea is the golden hammer, meaning an instrument that is so admired it is used for everything. This is regarded as an anti-pattern.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .