What Javascript / jQuery pattern is this to enclosing and hiding everything but still can alter the page?
<p>Did somebody come up with this pattern so it is a famous and well-known pattern?
I see this pattern for using Javascript / jQuery, such as in <code>init.js</code>:</p>

<pre><code>var Initializations = {};

Initializations = (function($) {

  function doSomething(i, domElement) { 
    // ... 
  }

  $(function() {
    $("#foo").click(function() {
      // ...
    });
    $(".bar").each(doSomething);
  });

})(jQuery);
</code></pre>

<p>So it looks like it can "hide" almost everything from the global scope, avoid conflict if another library also uses <code>$</code> as a variable, and the HTML page can be altered by this code using jQuery.  The code does almost nothing to the global scope (except the variable <code>Initializations</code>), and even if there are
2 jQuery versions, and if they can be denoted by 2 variables <code>jQuery142</code> and <code>jQuery161</code>, then the code can be even using 2 jQuery libraries just by changing the last line of the code above
to <code>jQuery161</code> (say, if some 3rd party code needs jQuery 1.4.2 and your code has been using jQuery 1.6.1 for new features and/or bug fixes).</p>

<p>Can the above code be improved?  I am wondering why the extra variable <code>Initializations</code>, why not just:</p>

<pre><code>(function($) {

  function doSomething(i, domElement) { 
    // ... 
  }

  $(function() {
    $("#foo").click(function() {
      // ...
    });
    $(".bar").each(doSomething);
  });

})(jQuery);
</code></pre>

<p>?</p>
