Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I used to love the Singleton (anti-)pattern. It's a huge improvement from using your AppDelegate as a global storage area, but it still encourages sloppy code. I find it the code much cleaner when you pass in the objects a class needs instead of calling up the singleton from all over the place.

There are some legitimate uses for singletons, but if you need a singleton macro, you're probably over using it.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: