On Thu, Mar 14, 2013 at 7:00 PM, user123 <ivanschu...@gmail.com> wrote:
> What is the problem with singleton?

http://stackoverflow.com/questions/7026507/why-are-static-variables-considered-evil
http://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons

And, since they don't seem to emphasize the point quite enough for my
taste: static data members are, by definition, memory leaks. How *bad*
of a memory leak they are depends on what they are and how they are
used.

Like many programming techniques, singletons can be used as a scalpel
or a sledgehammer. The general advice against singletons is because
most people reading that advice are inexperienced and are likely to do
damage with either a scalpel or a sledgehammer.

On the whole, AFAICT, tolerance for singletons decreases with
increased production Java development experience, based on the
conversations that I have had on the topic over the past few years.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.6 Available!

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to