title: What's wrong with this style of coding JavaScript? (closures vs. prototypes)
body: <p>We have been debating how best to handle objects in our JS app, studying Stoyan Stefanov's book, reading endless SO posts on 'new', 'this', 'prototype', closures etc. (The fact that there are so many, and they have so many competing theories, suggests there is no completely obvious answer).</p>
  
  <p>So let's <strong>assume the we don't care about private data</strong>. We are content to trust users and developers not to mess around in objects outside the ways we define.</p>
  
  <p><strong>Given this</strong>, what (other than it seeming to defy decades of OO style and history) would be wrong with this technique?</p>
  
  <pre><code>// namespace to isolate all PERSON's logic
  var PERSON = {};
  
  // return an object which should only ever contain data.
  // The Catch: it's 100% public
  
  PERSON.constructor = function (name) {
       return {
           name: name
       } 
  }
  
  // methods that operate on a Person
  // the thing we're operating on gets passed in
  
  PERSON.sayHello = function (person) {
       alert (person.name); 
  }
  
  var p = PERSON.constructor ("Fred");
  var q = PERSON.constructor ("Me");
  
  // normally this coded like 'p.sayHello()'
  PERSON.sayHello(p);
  PERSON.sayHello(q);
  </code></pre>
  
  <p>Obviously:</p>
  
  <ol>
  <li>There would be nothing to stop someone from mutating 'p' in unholy
  ways, or simply the logic of PERSON ending up spread all over the place. (<strong>That is true with the canonical 'new' technique</strong> as well).</li>
  <li>It would be a minor hassle to pass 'p' in to every function that you
  wanted to use it.</li>
  <li>This is a <strong>weird approach</strong>.</li>
  </ol>
  
  <p>But are those good enough reasons to dismiss it? On the positive side:</p>
  
  <ol>
  <li>It is <strong>efficient</strong>, as (arguably) opposed to closures with repetitive function declaration.</li>
  <li>It seems <strong>very simple and understandable</strong>, as opposed to fiddling with
  'this' everywhere.</li>
  </ol>
  
  <p>The key point is the <strong>foregoing of privacy</strong>. I know I will get slammed for this, but, looking for any feedback. Cheers.</p>