title: Best practice for sharing instances between Objects
body: <p>Let's assume I have a class <code>MainActivity</code>.</p>
  
  <p>This contains a number of objects stored in fields, such as instances of <code>Player</code>, <code>Enemy</code>, <code>Level</code>, etc. Each of these objects needs to be able to refer to every other object.</p>
  
  <p>What is the best way to go about this?</p>
  
  <ol>
  <li><p>Make these fields static, and refer to them accordingly, i.e.</p>
  
  <pre><code>MainActivity.player.setHealth(0);
  </code></pre></li>
  <li><p>Create getter methods for each field, and simply pass each object a reference to <code>MainActivity</code>, so that they can call these getter methods, i.e.</p>
  
  <pre><code>mainActivity.getPlayer().setHealth(0);
  </code></pre></li>
  <li><p>Pass each object a reference to every <em>other</em> object, and store these references in fields within each object, so that they can be referred to directly, i.e.</p>
  
  <pre><code> player.setHealth(0);
  </code></pre></li>
  </ol>