title: Should I instantiate other classes in a constructor?
body: <p>Recently, I saw a colleague of mine instantiate his classes in a constructor, so I started doing the same, like this:</p>
  
  <pre><code>class FooBar{
  private $model1;
  private $model2;
      public function __construct() {
          $this-&gt;model1=new Model1();
              $this-&gt;model2=new Model2();
      }
  }
  </code></pre>
  
  <p>And now I'm starting to wonder, if maybe instantiating the models everywhere where they are needed may be better?</p>
  
  <p>E.g., function <code>foo()</code> needs model1 and function <code>bar()</code> needs model2, but now both models are loaded. </p>
  
  <p>So, the question: <strong>Is this the right way to instantiate other classes? Or should I just instantiate them when I need them in a function?</strong></p>