title: when to define a module and when to only require files using requireJS
body: <p>I'm struggling to get requireJS to work properly. Page is running fine, but I think I'm doing things in an oh-so wrong way.</p>
  
  <p>For example, <strong>on page xzy</strong> I'm adding the following JavaScript at the end of the page (the JS must stay on the page for now, so no external js-files possible)</p>
  
  <pre><code>&lt;script type="text/javascript" language="javascript"&gt;
    //&lt;![CDATA[
    (function () {
      require([
        'async!http://maps.google.com/maps/api/js?v=3&amp;sensor=false',
        'maps/jquery.ui.map.full.min.js',
        'maps/jquery.ui.map.extensions.min'
        ], function() {
  
          // ... do stuff with Google Maps
  
        }
      );
    }());
  //]]&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>
     </p>
  
  <p>Doing this makes <code>google.map</code> and the <code>$.().gmap</code> method globally available, which probably shouldn't be available globally.</p>
  
  <p><strong>Questions:</strong><br>
  Should I convert this into a requireJS module? Why?  </p>
  
  <p>If so, will the module be available on other pages as well or do I just "re-define" on <strong>page 123</strong> and the dependency files will already have been cached?   </p>
  
  <p>And finally - will I have to convert the code inside my require call into module.methods, which I then call via <code>module_name.method_name(pass_some_parameters)</code>?</p>