title: Public and Privileged methods in javascript: Why are they called that way?
body: <p>If I understand correctly, according to Douglas Crockford <a href="http://javascript.crockford.com/private.html">http://javascript.crockford.com/private.html</a>, the "privileged" methods are similar to what we know as "public" methods. and "public" methods are something that's a bit different.</p>
  
  <p>Here's how I understand it:</p>
  
  <ol>
  <li><p>"Privileged" methods can access private variables since it is defined inside the closure when the rest of the private variables were defined.</p>
  
  <pre><code>var C = function(){
    var private;
    this.privilegedMethod = function(){
         /* blah blah */
    };
  }
  var cObj = new C();
  </code></pre></li>
  <li><p>"Public" methods are the ones that are added to the object outside of the object itself, through prototype.</p>
  
  <pre><code>var C = function(){
     /* blah blah */
  }
  C.prototype.publicMethod = function(){
      /* blah blah */
  };
  var cObj = new C();
  </code></pre></li>
  </ol>
  
  <p>I find these definitions of "privileged" and "public" very confusing. I think the "privileged" method is nothing more than actually a public method as we know it from object oriented programming. And I think the "public" method is the one that should be named as something else. If you think about it, it's a weird type of function, it's a member of the object but it cannot access any other private variables, which means it doesn't contribute to encapsulation. It's almost like an independent helper method for the object.</p>
  
  <p>So I was wondering, why did Douglas Crockford come up with these confusing terms? And why have the javascript community adopted these terminologies? Or if I'm wrong about something, please correct me.</p>