title: Different ways of extending classes in node.js
body: <p>Extending prototypical classes in node.js or javascript in general. (js newb)</p>
  
  <p>I was looking at the source-code of expressjs and saw <a href="https://github.com/visionmedia/express/blob/master/lib/express.js" rel="nofollow">this</a>:</p>
  
  <pre><code>var mixin = require('utils-merge'); 
  ....
  mixin(app, proto);
  mixin(app, EventEmitter.prototype);
  </code></pre>
  
  <p><code>Utils-merge</code> seems like an external module. What are the difference of above and just doing something like:</p>
  
  <pre><code>var util = require('util');
  ....
  util.inherit(app, proto);
  util.inherit(app, EventEmitter);
  </code></pre>
  
  <p>And is this still trying to extend properties? I'm kind-a lost here:</p>
  
  <pre><code>app.request = { __proto__: req, app: app }; // what is the equivalent for this in util?
  app.response = { __proto__: res, app: app };
  </code></pre>
  
  <p>If so, will that still work even if <code>util.inherit</code> is used?</p>
  
  <pre><code>app.request = util.inherit(app, req)
  </code></pre>
  
  <p>Or something like that? jshint says <code>__proto__</code> is depricated.</p>
  
  <hr>
  
  <p>Additionally I also saw this?</p>
  
  <pre><code>var res = module.exports = {
    __proto__: http.ServerResponse.prototype
  };
  </code></pre>
  
  <p>Could this be?</p>
  
  <pre><code>var res = module.exports = util.inherits...??
  </code></pre>