title: Link classes together
body: <p>I creating PHP applications and I have question about architecture.</p>
  
  <p>I have some <em>systems</em> in my app.
  For example, <em>Cache system</em>, <em>Output system</em>, <em>Applications system</em>, etc.
  Also I have <em>Registry</em> for link this systems together.</p>
  
  <p>Here is example of using <em>Cache</em> in <em>Applications</em>:</p>
  
  <pre><code>class Manager {
  
      public function __construct() {
          $registry = \Jx\System\JxRegistry::getInstance();
          $this-&gt;JxCache = $registry -&gt; JxCache;
      }
  
      public function getAppInfo($JxId) {
          $someInfo = $this-&gt;JxCache-&gt;Applications-&gt;$JxId;
      }
  
  }
  </code></pre>
  
  <p>But this way I need to call <em>Registry</em> everywhere and I need to create local variables to store objects.</p>
  
  <p>I have another idea, something like this:</p>
  
  <pre><code>class Kernel {
      public function __construct() {
          $this-&gt;JxCache = new JxCache;
      }
  }
  /* .. */
  new Kernel();
  /* .. */
  class Manager extends Kernel {
  
      public function __construct() {
  
      }
  
      public function getAppInfo($JxId) {
          $someInfo = $this-&gt;JxCache-&gt;Applications-&gt;$JxId; //JxCache declared in class 'Kernel'
      }
  
  }
  </code></pre>
  
  <p>Which variant more right?
  Can you suggest your variants?
  Thank </p>