title: Node.js - use of module.exports as a constructor
body: <p>According to the Node.js manual:</p>
  
  <blockquote>
    <p>If you want the root of your module's export to be a function (such as
    a constructor) or if you want to export a complete object in one
    assignment instead of building it one property at a time, assign it to
    module.exports instead of exports.</p>
  </blockquote>
  
  <p>The example given is:</p>
  
  <pre><code>// file: square.js
  module.exports = function(width) {
    return {
      area: function() {
        return width * width;
      }
    };
  }
  </code></pre>
  
  <p>and used like this:</p>
  
  <pre><code>var square = require('./square.js');
  var mySquare = square(2);
  console.log('The area of my square is ' + mySquare.area());
  </code></pre>
  
  <p>My question: why does the example not use square as an object? Is the following valid and does it make the example more "object oriented"?</p>
  
  <pre><code>var Square = require('./square.js');
  var mySquare = new Square(2);
  console.log('The area of my square is ' + mySquare.area());
  </code></pre>