spacer

AspAlliance.com Web
AspAlliance
Register
Edit My Profile
Author List
Write for Us
About AspAlliance
Contact Us
Privacy Policy
Link To Us
Advertise

Subscribe
Free Newsletter
Newsletter Archive
RSS Syndication spacer

.NET Tutorials
Learn .NET
Learn WCF
Learn WPF
Learn ASP.NET
Learn AJAX
Learn Silverlight
Learn Visual Studio
Learn ADO.NET
Learn LINQ
Learn C# (CSharp)
Learn VB.NET
Learn Web Services
Learn Controls
Learn BizTalk
Learn SharePoint
Learn Mobile
Learn SQL
Learn SQL Reporting
Learn Windows Forms
Learn XML
Learn Crystal Reports
Learn FarPoint
Learn DevExpress
Examples
ASP.NET 2.0 Examples

ASP Tutorials
Learn ASP
Learn VBScript
Learn JScript
Learn SQL
Learn XML

Software Resources
Shopping Cart Ecommerce
Charts and Dashboards

Other Resources
Learn Java
Learn Oracle
Opinion / Editorial
Crystal Reports Alliance
WPF Resources
AJAX Resources
Silverlight Resources

Free Tools
Cache Manager
SimpleCMS

Reviews
Book Reviews
Product Reviews
Expert Advice

Books
ASP.NET Developer's Cookbook
Sample Chapters
Book Reviews

Community
Regular Expressions

spacer spacer spacer
spacer  Print  spacer  Add To Favorites    spacer  Email To Friend  spacer  Rate This Article   
Alternatives to the Singleton Design Pattern
page 1 of 6
Published: 23 Nov 2010
Unedited - Community Contributed
Abstract
The Singleton Design Pattern is one of the simplest and most widely known design patterns in use in software development. However, despite its simplicity, it is very easy to get wrong and the consequences of its use even when properly implemented can outweigh its benefits. It turns out there are other ways to achieve the goals of the Singleton pattern which will often prove to be simpler, safer, and more maintainable.
spacer
by Steven Smith
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 9210/ 186
Article Contents:
  • Introduction
  • The Singleton Pattern
  • Single Responsibility Principle
  • Testing
  • IOC Container Managed Lifetime
  • References and Summary

Introduction

The Singleton Design Pattern is one of the simplest design patterns in software development, yet one of the easiest to misuse as well.  In this article, we'll examine some alternatives to the Singleton pattern in its most naïve implementation, as well as consider an alternative to making classes themselves responsible for managing their instances.


View Entire Article
(Page 2) »

Article Feedback

Title:
Name:
Url: ( Optional )
Comment:
Please add 2 and 4 and type the answer here:

User Comments

Title: Just use public static readonly   
Name: Ramon Smits
Date: 12/8/2010 7:42:43 PM
Comment:
Just use a public static readonly member. Easy, fast, lazy and threadsafe!

public class MyClass
{
public static readonly MyClass Instance = new MyClass();
private MyClass(){}
}

Much easier then this will be difficult to do!

Product Spotlight
spacer  

spacer
spacer

spacer
Latest Resources
» 1 Cent Hosting
» 1 Cent Hosting
» TeeChart for .NET
» Outsourced Product Development
» To export Gridview to ExcelSheet

spacer
Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2012 ASPAlliance.com  |  Page Processed at 3/22/2012 2:40:25 PM  spacer
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.