What is meant by the term "hook" in programming?

Chris picture Chris · Jan 22, 2009 · Viewed 109.6k times · Source

I recently heard the term "hook" while talking to some people about a program I was writing. I'm unsure exactly what this term implies although I inferred from the conversation that a hook is a type of function. I searched for a definition but was unable to find a good answer. Would someone be able to give me an idea of what this term generally means and perhaps a small example to illustrate the definition?

Answer

Micah picture Micah · Jan 22, 2009

Essentially it's a place in code that allows you to tap in to a module to either provide different behavior or to react when something happens.