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

Reply via email to