D Melodic Minor AccidentalA conglomeration of random thoughts on C#, .NET, OOP, and working at MicrosoftMore Singleton- May 21, 2004 Ok, so I lied: I'm not moving on to unions quite yet. Cyrus brought up a great point on the last post about .NET serialization, as well as the lack of thread safety in my third example. Due to the shared nature of singletons, I have to agree that thread-safety is an important enough requirement to mandate an expansion of the singleton story... In addition, Andrew provided a great link about some other thoughts on implementing singletons in...http://blogs.msdn.com/theoy/archive/2004/05/21/136610.aspx Singleton Pattern- May 21, 2004 In the beginning, there was...the singleton. Everything's got to start somewhere. Just like there's only one object type to &8220;rule them all&8221;, the singleton represents cases where there's only one. A pair of examples are the TextWriter instances that represents Standard Out and Standard Error. You only need one instance for each of those, for your entire program. It makes sense for all the code in your program, all the threads, all of ___(insert...http://blogs.msdn.com/theoy/archive/2004/05/20/136528.aspx Coming up: Design Patterns- May 21, 2004 Quick detour (not so much of a detour). Cyrus has challenged me to 48 hours in order to expound on how he could've written is IOptional<T> better. Actually, I started to explain some of my suggestions, but now he's imposed this limit, since he's too antsy for me to really finish writing out my entire rationale. So instead of writing real code, we're going to talk more about design and theory for a while... but I have a couple of caveats.(1) I'm going to assume that...http://blogs.msdn.com/theoy/archive/2004/05/20/136483.aspx |