Delete that run on sentence in the end of the second paragraph, apologies :-)

Kris

On Sun, Mar 17, 2013 at 2:16 PM, Kristopher Micinski
<[email protected]> wrote:
> I agree with your assessment, but I've never said singletons are evil.
>  I've just said that Java statics require more careful use and are
> frequently misused by beginners.  For experienced programmers, this
> advice is obviously insufficient: since there are times when statics
> really do help.
>
> I think Blake's example of a static final being a "singleton" seems
> strange, because that use of the "static" keyword is just a Java
> implementation of a constant.  While there are multiple
>
> Using statics is not universally horrible, in the same way that using
> statics lets you get more control over the memory behavior of your
> system.  There are also times when it's good to write native code too,
> and that's also something that should be handled very carefully.
> Statics essentially give you finer grained memory control, and like
> most things, more power is more responsibility.
>
> Unfortunately I'm afraid this topic has grown too big, and it looks
> like a another big argument about "don't do this" versus, "it has some
> use.."
>
> Kris
>
>
> On Sun, Mar 17, 2013 at 12:04 PM, Piren <[email protected]> wrote:
>> Honestly i don't get some of the comments here.
>>
>> Yeah, a bad programmer that doesn't understand how Java works will fuck up
>> with Singletons .. but that doesn't mean Singletons are evil.  As was
>> already stated - if they are so evil, why is the Android API using them for
>> pretty much anything that makes sense as a Singleton?
>>
>> In the article you posted, he gave a bad example... a bad programmer would
>> do what he did (since that is obviously prone to errors).. what's the point
>> of finding a way to make something look bad and thus deduce it is bad?
>> Eating cement is bad for you, thus cement is evil?
>>
>> If i have an app that has some class that does heavy calculations and to do
>> those faster, it can pre-calculate what it can (which still takes time)...
>> why not do it as a singleton? Would you rather have the user wait again and
>> again rather than keep a singleton with those pre-calculations to speed
>> everything up?
>>
>> Same applies for Lazy loading... if that Singleton is only used for some
>> part of the app that  might not be used frequently, why not lazy load it?
>> (especially if it has a fat memory footprint)
>>
>>
>> P.S - His example is even funnier since i do the exact opposite - i use a
>> static variable to see when Android did in fact close my app (since it is
>> being a bastard and not telling me it did)
>>
>>
>> On Sunday, March 17, 2013 5:28:47 PM UTC+2, G. Blake Meike wrote:
>>>
>>> @Lew on 3/14: +many  Why, oh why, do people insist on lazy initialization?
>>>
>>> A lot of the debate about singletons ignores specifics.  I bet nobody has
>>> a problem with:
>>>
>>> public static final String MY_CONSTANT = "CONSTANT";
>>>
>>> That's a singleton.  Singletons that are mutable are weirder.  Lazily
>>> initialized singletons that are mutable are the devil's tools.
>>>
>>> Further, as I point out here:
>>>
>>> http://portabledroid.wordpress.com/2012/05/04/singletons-in-android/
>>>
>>> "Singleton" is a relative term.  There is nearly no such thing as a
>>> singleton (well, maybe the earth, or the sun, or something like that).
>>> There are only singletons in context.  I have come to see many of the
>>> problem devs have with singletons not as a discussion of singletons
>>> themselves, but as a misunderstanding of the context in which they are
>>> singletons.
>>>
>>> -blake
>>
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> 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 [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to