NYCPHP Meetup

NYPHP.org

[nycphp-talk] Are Singletons Really Evil?

David Mintz david at davidmintz.org
Mon Mar 19 12:15:06 EDT 2012


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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20120319/791f8a34/attachment.html>


More information about the talk mailing list