title: Plugin system with events or hooks?
body: <p>I've created a plugin system for a software in php. In order for a plugin to alter the behaviour of the programm I wrote this (simplified) code:</p>
  
  <pre><code>class PluginController {
  
    /* ... */
  
    public function addHook($name, $function, $priority = 10) {
      /* store the function callback $function  associated with $name */
    }
  
    public function executeHook($name, $args = array()) {
      /* execute all function callbacks associated with $name
       * in order of their priority and return their results */    
    }
  }
  </code></pre>
  
  <p>So plugins can add callbacks using <code>addHook</code> and somewhere in the application these callbacks get executed by calling <code>executeHook</code>. </p>
  
  <p>This works quite well, but after reading some time about the topic, I'm still unsure if this technique is a <em>event-</em> or a <em>hook-</em> system. </p>
  
  <p>Some sources say the difference has to do with loose and tight coupling.
  Others say that hooks has return values, and events not. And others again say that events are for handlig asynchronous activity, and hooks just to inject code at some point.</p>
  
  <p>So again, is the above code about <em>events</em> or <em>hooks</em>, and can someone explain the difference?</p>