Thursday, September 13, 2012

Singleton Vs. Factory Pattern

Most commonly, singletons don't allow any parameters to be specified when creating the instance - as otherwise a second request for an instance but with a different parameter could be problematic! (If the same instance should be accessed for all requests with the same parameter, the factory pattern is more appropriate.)...
  • The factory pattern can be used if you need a single instance of a base type, but the exact type isn't known until runtime.
http://csharpindepth.com/Articles/General/Singleton.aspx

Wednesday, September 5, 2012

Fowler's Observations Outdated?

Fowler’s initial thinking was confined to HTML web presentation problems. He expanded the inventory in subsequent years through a series of posts that can be reached from here. The combined corpus of patterns still resonate for WPF and Silverlight developers even if the details aren’t a perfect fit for these more recent technologies.
http://neverindoubtnet.blogspot.com/2009/05/birth-and-death-of-m-v-vm-triads.html

Tuesday, September 4, 2012

Singleton Misused

 I saw a singleton used to store a reference to a web service, and then the developer called it from everywhere. So instead of properly designing her class library, she just had a spaghetti bowl of code interaction.
http://forums.silverlight.net/p/14017/45946.aspx