Instantiate an object on request or on load using the delegator design pattern
<p>Just looking for varying opinions and reasoning on this:</p>

<p>I want to maintain separate database tables for the delegated class should I:</p>

<p>A) Store the ID of the delegated objects record and initiate it on request like so ...</p>

<pre><code>class Book {

    private $Name;
    private $Color_ID;

    public
    function getColor() {
        return new Color($this - &gt; Color_ID);
    }
    //etc
}

class Color {

    private $Color_ID;
    private $Color_Name;

    public
    function __construct($Color_ID) {
        //Get from DB
    }
    //etc
}
</code></pre>

<p>B) Initiate and store the object on the parent initiation:</p>

<pre><code>class Book {

    private $Name;
    private $Color;

    public
    function __construct() {
        //Get $Color_ID from Books table
        $this - &gt; Color = new Color($Color_ID);
    }

    public
    function getColor() {
        return $Color;
    }
    //etc
}

class Color {

    private $Color_ID;
    private $Color_Name;

    public
    function __construct($Color_ID) {
        //Get from DB
    }
    //etc
}
</code></pre>

<p>If I get lots of requests for the color object am I better to store it to save on DB reads? Is increased memory usage a good trade off? Thoughts..</p>
