I agree with yo 100%. Not being able to lazy load resources doesn't
make sense. There are very few resources that are required with every
page load. Even the DB or View objects may not be necessary much of
the time with proper caching. I created my own resource manager that
creates resources only when they are requested and this handles all of
my resources. I still use a bootstrap class but it requests all
resources from the resource manager.



Mark

On Thu, Oct 14, 2010 at 3:09 PM, A.J. Brown <a...@ajbrown.org> wrote:
> Hi All,
>
> I've been doing some research on lazy loading resources in Zend Framework,
> and it seems that the decision has been made that resources that should be
> lazy loaded should not be a part of the bootstrapping mechanism.  I'm not
> sure that I agree with this idea, so I'd like to re-open the discussion.
>
> For example, I currently have code which makes use of Zend_Service_LiveDocx.
>  For Dependency Injection, I would rather the class be configured outside of
> the methods that are calling it, so creating a resource seems to be the best
> bet.  However, it's a "waste of time" to initialize the LiveDocx class 99%
> of the time, since only a small portion of the application uses it.  In this
> particular case I believe the overhead will be very minimal compared to the
> added complexity/duplication of doing it any other way, but that's not
> necessarily true in other cases.
>
> Being that resources are able to load their dependencies themselves using
> the Boostrap mechanism, wouldn't it make more sense to lazy load ALL
> resources by default?  Of course this becomes an issue when you're using
> _init functions in your Bootstrap class to configure the application, and
> they don't return any resources.  So, it seems that there needs to be some
> distinction between initialization and resources.  Or, perhaps, a
> distinction between resource classes, and init functions within the Boostrap
> file.
>
> Thoughts?
> --
> A.J. Brown
> Software Engineer, ZCE
> blog : http://ajbrown.org
> talk  : (937) 540-0099
> chat : IntypicaAJ
>



-- 
Have fun or die trying - but try not to actually die.

Reply via email to