title: Node.js modules vs Objects
body: <p>I have been playing around with node.js, and coming from a Java background, I am struggling to differentiate between modules and the typical concept of objects in JavaScript.</p>
  
  <p>When implementing a modules, I am currently doing it this way:</p>
  
  <pre><code>// someModule.js
  var privateVariable;
  this.sampleFunction = function() {
     // ...
  }
  </code></pre>
  
  <p>Now, the way I am using this module in another place is:</p>
  
  <pre><code>var moduleName = require('./someModule');
  
  var foo = moduleName.sampleFunction();
  </code></pre>
  
  <p>I don't know if this is the right way to do modular development in node.js - because I realized I am not actually using objects, like using new() - which I would need to do when I want to have collections etc. What is the right way to proceed here if I want a collection of person objects - how will my module and it's definition look like?</p>