Well, I've been using singleton for years, they do what they're supposed to do, make a class object "global", so that you save memory and make the call faster. Singleton/Multiton are not the best solution to make unit testable code and extendible. Dependency Injection dolce this problem, also creatina a standard container class ZF2 and Symfony, are creating a sorta of plugin interface, so that you can easily interchange the classes between the 2 framework. They're thought to standardize the coding to improve the team work. About performance, they're obviously slower, I spoke with Fabien Potencier and he's convinced about improving performance at the application layer with Varnish, Amazon etc., which I agree partially, because that is the right way for big project, definitely not for small one, like a CMS for everyone! So consider to keep using Singleton/Multiton and even Static Class when you need to!
Sent from my iPhone On Mar 19, 2012, at 12:15 PM, David Mintz <da...@davidmintz.org> wrote: Speaking as less advanced developer than most of you, in my genuinely humble opinion: I hope this isn't off-topic, but I've been working with Zend Framework 1 since it was in diapers. It had a learning curve and seemed a bit heavy but I felt it was worth it in my situation. Now comes ZF2, and as I start reading and learning about it, I can't help but wonder if I really need Dependency Injection. I hadn't noticed that I was having any problem managing my dependencies, thanks. There has been one case in my project where different classes needed access to a model instance, and I scratched my head for a while before deciding to use a singleton. This is the first I've heard that the pattern is considered evil by anyone. As I look at the ZF2 documentation, I'm like, wait a second. Is this not really, really complicated? Worse, perhaps, than the disease it's intended to cure? -- David Mintz http://davidmintz.org/ It ain't over: http://www.healthcare-now.org/ _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation
_______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show-participation