single ton of fun


May 14th, 2007

Out of all the common Design Patterns, the Singleton is probably the most misused one. Despite being a relatively easy concept to grasp, I’ve seen today some pretty novel ways of violating its principles, all done by people that should know how to code better than me.  Please, allow and manage one access point to the instance - and make sure it’s the same as the one that can initialize the instance, too! And use some thread protection - even if something as unpleasant as a synchronized method - to avoid twin singletons.

  • TwitThis
  • del.icio.us
  • StumbleUpon
  • Google
  • Technorati
  • YahooMyWeb
  • Live
  • Slashdot
  • Digg
  • Reddit
  • Facebook
  • Mixx

Post a Comment

Anything goes, as long as it is in English (proper, if possible). Try to keep the conversation civil, in the interest of Ideas.


«the convenience of insecurity | home | tip #54-F.1»