I've worked on a large Rails app where the use of ActiveRecord callbacks was rampant and harrowing. Saving a record often had unexpected side-effects and it was a challenge to reason about the system.
At the same time, I've seen hooks used to good effect as part of inheritance (e.g. a parent class using a template-method to allow subclasses to add specialized behavior without needing to know about the parent's internals), and in plug-ins (e.g. an emacs mode running a hook when it's activated, allowing users to add custom behavior around that mode).
I realize that a Rails app and a Lisp interpreter are vastly different systems, but I'm curious if there are any well-known criteria people look to when deciding whether hooks are the right design choice for the problem they're facing.
The theme that jumps out at me is predictability. Misuse of hooks seems to lead to spooky action at a distance and surprising behavior, whereas good use can lead to a framework that's predictable without tight coupling.
As I'm still only a few years into my programming career, I consider myself a noob in many respects, and suspect people have put a fair amount of thought into this topic. What are some guidelines that can steer this decision?