<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Smahish</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Smahish"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Smahish"/>
	<updated>2026-09-12T06:27:15Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70887</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70887"/>
		<updated>2012-11-19T23:20:31Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, Directory of Sites=&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:3.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html Simply Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Capabilities of Singleton pattern,Singleton design pattern class diagram, Example, use of protected constructors.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
The Singleton design pattern addresses all of the previous paragraph's concerns. With the Singleton design pattern you can:&lt;br /&gt;
* Ensure that only one instance of a class is created.&lt;br /&gt;
* Provide a global point of access to the object.&lt;br /&gt;
* Allow multiple instances in the future without affecting a singleton class's clients.&lt;br /&gt;
&lt;br /&gt;
As in , [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html#resources Design Patterns], &amp;quot;Ensure a class has a single instance, and provide a global point of access to it&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:4.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Other than the lazy initialization process, a classicSingleton class can also implement a protected constructor so client cannot instantiate ClassicSingleton instances; however, you may be surprised to discover that the following code is perfectly legal:&lt;br /&gt;
&lt;br /&gt;
 public class SingletonInstantiator { &lt;br /&gt;
 public SingletonInstantiator() { &lt;br /&gt;
 ClassicSingleton instance = ClassicSingleton.getInstance();&lt;br /&gt;
 ClassicSingleton anotherInstance =&lt;br /&gt;
 new ClassicSingleton();&lt;br /&gt;
 ... &lt;br /&gt;
  } &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Protected constructors can be called by subclasses and by other classes in the same package. Because ClassicSingleton and SingletonInstantiator are in the same package (the default package), SingletonInstantiator() methods can create ClassicSingleton instances. This dilemma has two solutions: You can make the ClassicSingleton constructor private so that only ClassicSingleton() methods call it; however, that means ClassicSingleton cannot be subclassed. Sometimes, that is a desirable solution; if so, it's a good idea to declare your singleton class final, which makes that intention explicit and allows the compiler to apply performance optimizations. The other solution is to put your singleton class in an explicit package, so classes in other packages (including the default package) cannot instantiate singleton instances.&lt;br /&gt;
&lt;br /&gt;
== [http://javapapers.com/design-patterns/singleton-pattern/ JavaPaper on Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Strategy for Singleton instance creation, Early and lazy instantiation in singleton pattern, Singleton and Serialization&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
There are only two points in the definition of a singleton design pattern,&lt;br /&gt;
* There should be only one instance allowed for a class and&lt;br /&gt;
* We should allow global point of access to that single instance.&lt;br /&gt;
&lt;br /&gt;
The key is not the problem and definition. In singleton pattern, trickier part is implementation and management of that single instance.&lt;br /&gt;
&lt;br /&gt;
We suppress the constructor and don’t allow even a single instance for the class. But we declare an attribute for that same class inside and create instance for that and return it. [http://javapapers.com/design-patterns/abstract-factory-pattern/ Factory design pattern] can be used to create the singleton instance.&lt;br /&gt;
&lt;br /&gt;
You need to be careful with multiple threads. If you don’t synchronize the method which is going to return the instance then, there is a possibility of allowing multiple instances in a multi-threaded scenario. Do the synchronization at block level considering the performance issues. In the below example for singleton pattern, you can see that it is threadsafe.&lt;br /&gt;
&lt;br /&gt;
 package com.javapapers.sample.designpattern;&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static Singleton singleInstance;&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getSingleInstance() {&lt;br /&gt;
 if (singleInstance == null) {&lt;br /&gt;
    synchronized (Singleton.class) {&lt;br /&gt;
      if (singleInstance == null) {&lt;br /&gt;
        singleInstance = new Singleton();&lt;br /&gt;
       }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    return singleInstance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Singleton and Serialization''' : Using [http://javapapers.com/core-java/java-serialization/ serialization], single instance contract of the singleton pattern can be violated. You can serialize and de-serialize and get a new instance of the same singleton class. Using java api, you can implement the below method and override the instance read from the stream. So that you can always ensure that you have single instance.&lt;br /&gt;
&lt;br /&gt;
 ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;&lt;br /&gt;
&lt;br /&gt;
'''Usage of Singleton Pattern in Java API''': &lt;br /&gt;
&lt;br /&gt;
 java.lang.Runtime#getRuntime() &lt;br /&gt;
 java.awt.Desktop#getDesktop()&lt;br /&gt;
&lt;br /&gt;
== [http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects Positive and Negative aspects of Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Introduction, Positive sides of Singleton, Lazy and Static initialization, Negative sides of Singleton, When to use a Singleton class.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
positive sides: The anatomy of a singleton class is very simple to understand. The class typically has a private constructor which will prohibit you to make any instance of the singleton class; instead you will access a static property or static function of the singleton class to get the reference of a preconfigured instance. These properties/methods ensure that there will be only one instance of the singleton class throughout the lifetime of the application.&lt;br /&gt;
&lt;br /&gt;
The one and only instance of a singleton class is created within the singleton class and its reference is consumed by the callers. The creation process of the instance can be done using any of the following methods:&lt;br /&gt;
&lt;br /&gt;
'''Lazy Initialization'''&lt;br /&gt;
If you opt for the lazy instantiation paradigm, then the singleton variable will not get memory until the property or function designated to return the reference is first called. This type of instantiation is very helpful if your singleton class is resource intense.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:5.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In order to make it thread-safe, One way is the use of double-checked locking. In double-checked locking, synchronization is only effective when the singleton variable is null, i.e., only for the first time call to Instance.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:6.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization'''&lt;br /&gt;
In static initialization, memory is allocated to the variable at the time it is declared. The instance creation takes place behind the scenes when any of the member singleton classes is accessed for the first time. The main advantage of this type of implementation is that the CLR automatically takes care of race conditions I explained in lazy instantiation. We don't have to use any special synchronization constructs here.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:7.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Inheriting a singleton class should be prohibited.&lt;br /&gt;
* Singleton takes over static classes on the following shortcomings:&lt;br /&gt;
  - Static classes don’t promote inheritance. If your class has some interface to derive from, static classes makes it impossible.&lt;br /&gt;
  - You cannot specify any creation logic with static methods. &lt;br /&gt;
  - Static methods are procedural code.&lt;br /&gt;
&lt;br /&gt;
'''Negative sides of Singleton''':&lt;br /&gt;
* They deviate from the Single Responsibility Principle. A singleton class has the responsibility to create an instance of itself along with other business responsibilities. However, this issue can be solved by delegating the creation part to a factory object.&lt;br /&gt;
* Singleton classes cannot be sub classed.&lt;br /&gt;
* Singletons can hide dependencies. One of the features of an efficient system architecture is minimizing dependencies between classes. This will in turn help you while conducting unit tests and while isolating any part of the program to a separate assembly.&lt;br /&gt;
&lt;br /&gt;
However, it is commonly accepted that the singleton can yield best results in a situation where various parts of an application concurrently try to access a shared resource. An example of a shared resource would be Logger, Print Spooler, etc. When designing a singleton, consider the following points:&lt;br /&gt;
* Singleton classes must be memory-leak free. The instance of the singleton class is to be created once and it remains for the lifetime of the application.&lt;br /&gt;
* A real singleton class is not easily extensible.&lt;br /&gt;
* Derive the singleton class from an interface. This helps while doing unit testing (using Dependency Injection).&lt;br /&gt;
&lt;br /&gt;
== [http://sourcemaking.com/design_patterns/singleton The Design pattern called Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Intent, Problem, Discussion, Structure, Example, Check List, Rules of Thumb  &lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
Application needs one, and only one, instance of an object. Additionally, lazy initialization and global access are necessary.&lt;br /&gt;
Singleton should be considered only if all three of the following criteria are satisfied:&lt;br /&gt;
* Ownership of the single instance cannot be reasonably assigned&lt;br /&gt;
* Lazy initialization is desirable&lt;br /&gt;
* Global access is not otherwise provided for&lt;br /&gt;
&lt;br /&gt;
If ownership of the single instance, when and how initialization occurs, and global access are not issues, Singleton is not sufficiently interesting.The Singleton pattern can be extended to support access to an application-specific number of instances. Make the class of the single instance responsible for access and “initialization on first use”. The single instance is a private static attribute. The accessor function is a public static method.&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
The Singleton pattern ensures that a class has only one instance and provides a global point of access to that instance. It is named after the singleton set, which is defined to be a set containing one element. The office of the President of the United States is a Singleton. The United States Constitution specifies the means by which a president is elected, limits the term of office, and defines the order of succession. As a result, there can be at most one active president at any given time. Regardless of the personal identity of the active president, the title, “The President of the United States” is a global point of access that identifies the person in the office.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:8.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Check List''':&lt;br /&gt;
* Define a private static attribute in the “single instance” class.&lt;br /&gt;
* Define a public static accessor function in the class.&lt;br /&gt;
* Do “lazy initialization” (creation on first use) in the accessor function.&lt;br /&gt;
* Define all constructors to be protected or private.&lt;br /&gt;
* Clients may only use the accessor function to manipulate the Singleton.&lt;br /&gt;
&lt;br /&gt;
'''Rules of thumb''':&lt;br /&gt;
* Abstract Factory, Builder, and Prototype can use Singleton in their implementation.&lt;br /&gt;
* Facade objects are often Singletons because only one Facade object is required.&lt;br /&gt;
* State objects are often Singletons.&lt;br /&gt;
* The advantage of Singleton over global variables is that you are absolutely sure of the number of instances when you use Singleton, and,   &lt;br /&gt;
you can change your mind and manage any number of instances.&lt;br /&gt;
* The Singleton design pattern is one of the most inappropriately used patterns. Singletons are intended to be used when a class must have exactly one instance, no more, no less. Designers frequently use Singletons in a misguided attempt to replace global variables. A Singleton is, for intents and purposes, a global variable. The Singleton does not do away with the global; it merely renames it.&lt;br /&gt;
* When is Singleton unnecessary? Short answer: most of the time. Long answer: when it’s simpler to pass an object resource as a reference to the objects that need it, rather than letting objects access the resource globally.&lt;br /&gt;
&lt;br /&gt;
== [http://c2.com/cgi/wiki?SingletonPattern Singleton explained on c2.com]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Simulation of global variables, Appropriate Use of Singleton, Singleton in threaded environment&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly explains aspects like testing, creational logic,polymorphism involved in singleton pattern.It explains situations when singleton pattern can be used.It goes on to explain the anti-pattern of singletons simulating global variables and appropriate use of singleton in mutithreaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Problem of using Singleton in Multithreaded Environment''' : &lt;br /&gt;
&lt;br /&gt;
 static private synchronized Singleton instance_helper(){&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;quot;_instance&amp;quot; can be null in the logic for multiple threads before instance_helper is called, leading to multiple instances being created&lt;br /&gt;
&lt;br /&gt;
'''Solution for Singleton in Multithreaded Environment''' : &lt;br /&gt;
 &lt;br /&gt;
 static private synchronized Singleton instance_helper()&lt;br /&gt;
 {&lt;br /&gt;
 if(flag)&lt;br /&gt;
 {&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 flag = false;&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
== [http://www.oodesign.com/singleton-pattern.html Singleton Applications]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Motivation, Intent, Implementation, Applicability and Examples&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link gives some extra information about applicability of Singleton in logger classes,configuration classes, accessing resources in shared environment,factories implemented as Singleton,Implementations and problems involved&lt;br /&gt;
&lt;br /&gt;
'''Serialization''' :&lt;br /&gt;
&lt;br /&gt;
If the Singleton class implements the java.io.Serializable interface, when a singleton is serialized and then deserialized more than once, there will be multiple instances of Singleton created. In order to avoid this the readResolve method should be implemented. &lt;br /&gt;
&lt;br /&gt;
 public class Singleton implements Serializable {&lt;br /&gt;
 ...&lt;br /&gt;
 // This method is called immediately after an object of this class is deserialized.&lt;br /&gt;
 // This method returns the singleton instance.&lt;br /&gt;
 protected Object readResolve() {&lt;br /&gt;
 return getInstance();&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[http://msdn.microsoft.com/en-us/library/ff650316.aspx Singleton Implementation in C#]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Implementation in C#&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link explains how to implement a singleton in C# both in static and threaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization''':&lt;br /&gt;
&lt;br /&gt;
One of the reasons Design Patterns [Gamma95] avoided static initialization is because the C++ specification left some ambiguity around the initialization order of static variables. Fortunately, the .NET Framework resolves this ambiguity through its handling of variable initialization:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 public sealed class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static readonly Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton(){}&lt;br /&gt;
 public static Singleton Instance&lt;br /&gt;
 {&lt;br /&gt;
 get &lt;br /&gt;
 { &lt;br /&gt;
 return instance; &lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing Singleton in C# results in the following benefits and liabilities:&lt;br /&gt;
&lt;br /&gt;
'''Benefits''':&lt;br /&gt;
*The static initialization approach is possible because the .NET Framework explicitly defines how and when static variable initialization occurs.&lt;br /&gt;
*The Double-Check Locking idiom described earlier in &amp;quot;Multithreaded Singleton&amp;quot; is implemented correctly in the common language runtime.&lt;br /&gt;
&lt;br /&gt;
'''Liabilities''':&lt;br /&gt;
If your multithreaded application requires explicit initialization, you have to take precautions to avoid threading issues.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html Refactor Singleton Out Of Your Code]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Solution to refactor singleton&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Gang of Four mentions Singleton as an anti-pattern and not as a pattern. This Link provides a solution to refactor Singleton out of the code&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
'''Steps to refactor Singleton:'''&lt;br /&gt;
* Create simple interface for Registry with two simple methods - getter and setter for instance of class which is currently implemented as singleton.&lt;br /&gt;
 public interface ISingletonRegistry {&lt;br /&gt;
 SingletonClass getSingletonClass();&lt;br /&gt;
 void setSingletonClass(SingletonClass singleton);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Make SingletonClass's constructor public&lt;br /&gt;
&lt;br /&gt;
* Then implement the interface as a simplest Registry design pattern implementation - SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
 public class SingletonRegistry implements ISingletonRegistry {&lt;br /&gt;
 private static final SingletonRegistry INSTANCE = new SingletonRegistry();&lt;br /&gt;
 private SingletonClass singleton;&lt;br /&gt;
 public static ISingletonRegistry getInstance() {&lt;br /&gt;
 return INSTANCE;&lt;br /&gt;
 }&lt;br /&gt;
 private SingletonRegistry() {&lt;br /&gt;
 //this is the reason why the constructor should be public&lt;br /&gt;
 singleton = new SingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
 public SingletonClass getSingletonClass() {&lt;br /&gt;
 return singleton;&lt;br /&gt;
 }&lt;br /&gt;
 public void setSingletonClass(SingletonClass singleton) {&lt;br /&gt;
 this.singleton = singleton;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Change getInstance method of SingletonClass to get instance from SingletonRegistry.&lt;br /&gt;
 public static SingletonClass getInstance() {&lt;br /&gt;
 return SingletonRegistry.getInstance().getSingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The method getInstance from SingletonClass disappears and all it's client classes uses SingletonRegistry to access SingletonClass.&lt;br /&gt;
 public class Client {&lt;br /&gt;
 public void clientMethod() {&lt;br /&gt;
 SingletonRegistry.getInstance() .getSingletonClass().voidMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 Object object = SingletonRegistry.getInstance() .getSingletonClass().objectMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Delete INSTANCE constant from SingletonClass class.&lt;br /&gt;
&lt;br /&gt;
* You can Extract Interface (Alt+Shift+T, E) from SingletonClass. Write just new interface name, select all methods from SingletonClass which you can extract into new interface and press OK. All references to SingletonClass will be refactored to references to your newly created interface.&lt;br /&gt;
&lt;br /&gt;
And that is all. Now you have SingletonClass with totally same functionality but you are able to mock it, extend or replace by different implementation setting up your instance of SingletonClass to SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
== [http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern/ Refactoring:Extracting the Singleton Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Extracting the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Here, the author demonstrates the refactoring of Singleton Pattern by means of an example of a Device Manger class. So the main class that will be changing is the DeviceManager. This class manages a collection of Devices (or a dictionary, to be more precise) and allows to set which is the active device and to get a device by id. Note that this last feature could be handled by the Devices collection, but we are taking advantage of the dictionary to make that look-up more efficient.&lt;br /&gt;
&lt;br /&gt;
== [http://www.roseindia.net/designpattern/singleton_pattern.shtml Singleton Pattern Usage and Benefits]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Usage, Benefits, Example&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and usage in multithreaded environment.Singleton patterns are often used as global variables because the global variables permit allocation and initialization whenever required. They don't permit to pollute the global namespace with unnecessary variables.&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
 package singleton;&lt;br /&gt;
 public class Logger {&lt;br /&gt;
 private String fileName;&lt;br /&gt;
 private Properties properties;&lt;br /&gt;
 private Priority priority;&lt;br /&gt;
 private Logger() {&lt;br /&gt;
 logger = this;&lt;br /&gt;
 }&lt;br /&gt;
 public int getRegisteredLevel() {&lt;br /&gt;
 int i = 0;&lt;br /&gt;
 try {&lt;br /&gt;
 InputStream inputstream = getClass().getResourceAsStream(&amp;quot;Logger.properties&amp;quot;);&lt;br /&gt;
 properties.load(inputstream);&lt;br /&gt;
 inputstream.close();&lt;br /&gt;
 i = Integer.parseInt(properties.getProperty(&amp;quot;logger.registeredlevel&amp;quot;));&lt;br /&gt;
 if(i &amp;lt; 0 || i &amp;gt; 3)&lt;br /&gt;
 i = 0;&lt;br /&gt;
 }&lt;br /&gt;
 catch(Exception exception) {&lt;br /&gt;
 System.out.println(&amp;quot;Logger: Failed in the getRegisteredLevel method&amp;quot;);&lt;br /&gt;
 exception.printStackTrace();&lt;br /&gt;
 }&lt;br /&gt;
 return i;&lt;br /&gt;
 }&lt;br /&gt;
 public static void initialize() {&lt;br /&gt;
 logger = new Logger();&lt;br /&gt;
 }&lt;br /&gt;
 // singleton - pattern&lt;br /&gt;
 private static Logger logger;&lt;br /&gt;
 public static Logger getLogger() {&lt;br /&gt;
 return logger;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== [http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern Critique of the Singleton Pattern]==&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Critique of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and flexibility and drawbacks like overhead, development confusion and Object lifetime while using the singleton pattern.&lt;br /&gt;
&lt;br /&gt;
==[http://www.ibm.com/developerworks/webservices/library/co-single/index.html Use Singletons Wisely]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
When to use, Moving away from Singletons, Aggregating Singletons&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The programming community discourages using global data and objects. Still, there are times when an application needs a single instance of a given class and a global point of access to that class. The general solution is the design pattern known as singletons. However, singletons are unnecessarily difficult to test and may make strong assumptions about the applications that will use them. In this article the author discusses strategies for avoiding the singleton pattern for that majority of cases where it is not appropriate. He also describes the properties of some classes that are truly singletons.&lt;br /&gt;
&lt;br /&gt;
'''Aggregating Singletons: The Toolbox''':&lt;br /&gt;
Singleton abuse can be avoided by looking at the problem from a different angle. Suppose an application needs only one instance of a class and the application configures that class at startup: Why should the class itself be responsible for being a singleton? It seems quite logical for the application to take on this responsibility, since the application requires this kind of behavior. The application, not the component, should be the singleton. The application then makes an instance of the component available for any application-specific code to use. When an application uses several such components, it can aggregate them into what we have called a toolbox.&lt;br /&gt;
Put simply, the application's toolbox is a singleton that is responsible either for configuring itself or for allowing the application's startup mechanism to configure it. The general pattern of the Toolbox singleton is as shown in the example provided in this article&lt;br /&gt;
The Toolbox is itself a singleton, and it manages the lifetime of the various component instances. Either the application configures it, or it asks the application for configuration information in method initialize. Now the application can decide how many instances of which classes it requires. Changes in those decisions may affect application-specific code, but not reusable, infrastructure-level code. Moreover, testing infrastructure code is much easier, as those classes do not rely on the way in which any application may choose to use them.&lt;br /&gt;
&lt;br /&gt;
== [http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious When Not to Use Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Appropriate Use of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The Gang of Four states that you'll want to use Singleton there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point or when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx&lt;br /&gt;
&lt;br /&gt;
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html&lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/singleton&lt;br /&gt;
&lt;br /&gt;
http://c2.com/cgi/wiki?SingletonPattern&lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/singleton-pattern.html&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/en-us/library/ff650316.aspx&lt;br /&gt;
&lt;br /&gt;
http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html&lt;br /&gt;
&lt;br /&gt;
http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern&lt;br /&gt;
&lt;br /&gt;
http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern&lt;br /&gt;
&lt;br /&gt;
http://www.roseindia.net/designpattern/singleton_pattern.shtml&lt;br /&gt;
&lt;br /&gt;
http://www.ibm.com/developerworks/webservices/library/co-single/index.html&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:8.gif&amp;diff=70880</id>
		<title>File:8.gif</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:8.gif&amp;diff=70880"/>
		<updated>2012-11-19T23:14:53Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70851</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70851"/>
		<updated>2012-11-19T22:45:33Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Positive and Negative aspects of Singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, Directory of Sites=&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:3.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html Simply Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Capabilities of Singleton pattern,Singleton design pattern class diagram, Example, use of protected constructors.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
The Singleton design pattern addresses all of the previous paragraph's concerns. With the Singleton design pattern you can:&lt;br /&gt;
* Ensure that only one instance of a class is created.&lt;br /&gt;
* Provide a global point of access to the object.&lt;br /&gt;
* Allow multiple instances in the future without affecting a singleton class's clients.&lt;br /&gt;
&lt;br /&gt;
As in , [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html#resources Design Patterns], &amp;quot;Ensure a class has a single instance, and provide a global point of access to it&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:4.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Other than the lazy initialization process, a classicSingleton class can also implement a protected constructor so client cannot instantiate ClassicSingleton instances; however, you may be surprised to discover that the following code is perfectly legal:&lt;br /&gt;
&lt;br /&gt;
 public class SingletonInstantiator { &lt;br /&gt;
 public SingletonInstantiator() { &lt;br /&gt;
 ClassicSingleton instance = ClassicSingleton.getInstance();&lt;br /&gt;
 ClassicSingleton anotherInstance =&lt;br /&gt;
 new ClassicSingleton();&lt;br /&gt;
 ... &lt;br /&gt;
  } &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Protected constructors can be called by subclasses and by other classes in the same package. Because ClassicSingleton and SingletonInstantiator are in the same package (the default package), SingletonInstantiator() methods can create ClassicSingleton instances. This dilemma has two solutions: You can make the ClassicSingleton constructor private so that only ClassicSingleton() methods call it; however, that means ClassicSingleton cannot be subclassed. Sometimes, that is a desirable solution; if so, it's a good idea to declare your singleton class final, which makes that intention explicit and allows the compiler to apply performance optimizations. The other solution is to put your singleton class in an explicit package, so classes in other packages (including the default package) cannot instantiate singleton instances.&lt;br /&gt;
&lt;br /&gt;
== [http://javapapers.com/design-patterns/singleton-pattern/ JavaPaper on Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Strategy for Singleton instance creation, Early and lazy instantiation in singleton pattern, Singleton and Serialization&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
There are only two points in the definition of a singleton design pattern,&lt;br /&gt;
* There should be only one instance allowed for a class and&lt;br /&gt;
* We should allow global point of access to that single instance.&lt;br /&gt;
&lt;br /&gt;
The key is not the problem and definition. In singleton pattern, trickier part is implementation and management of that single instance.&lt;br /&gt;
&lt;br /&gt;
We suppress the constructor and don’t allow even a single instance for the class. But we declare an attribute for that same class inside and create instance for that and return it. [http://javapapers.com/design-patterns/abstract-factory-pattern/ Factory design pattern] can be used to create the singleton instance.&lt;br /&gt;
&lt;br /&gt;
You need to be careful with multiple threads. If you don’t synchronize the method which is going to return the instance then, there is a possibility of allowing multiple instances in a multi-threaded scenario. Do the synchronization at block level considering the performance issues. In the below example for singleton pattern, you can see that it is threadsafe.&lt;br /&gt;
&lt;br /&gt;
 package com.javapapers.sample.designpattern;&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static Singleton singleInstance;&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getSingleInstance() {&lt;br /&gt;
 if (singleInstance == null) {&lt;br /&gt;
    synchronized (Singleton.class) {&lt;br /&gt;
      if (singleInstance == null) {&lt;br /&gt;
        singleInstance = new Singleton();&lt;br /&gt;
       }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    return singleInstance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Singleton and Serialization''' : Using [http://javapapers.com/core-java/java-serialization/ serialization], single instance contract of the singleton pattern can be violated. You can serialize and de-serialize and get a new instance of the same singleton class. Using java api, you can implement the below method and override the instance read from the stream. So that you can always ensure that you have single instance.&lt;br /&gt;
&lt;br /&gt;
 ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;&lt;br /&gt;
&lt;br /&gt;
'''Usage of Singleton Pattern in Java API''': &lt;br /&gt;
&lt;br /&gt;
 java.lang.Runtime#getRuntime() &lt;br /&gt;
 java.awt.Desktop#getDesktop()&lt;br /&gt;
&lt;br /&gt;
== [http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects Positive and Negative aspects of Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Introduction, Positive sides of Singleton, Lazy and Static initialization, Negative sides of Singleton, When to use a Singleton class.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
positive sides: The anatomy of a singleton class is very simple to understand. The class typically has a private constructor which will prohibit you to make any instance of the singleton class; instead you will access a static property or static function of the singleton class to get the reference of a preconfigured instance. These properties/methods ensure that there will be only one instance of the singleton class throughout the lifetime of the application.&lt;br /&gt;
&lt;br /&gt;
The one and only instance of a singleton class is created within the singleton class and its reference is consumed by the callers. The creation process of the instance can be done using any of the following methods:&lt;br /&gt;
&lt;br /&gt;
'''Lazy Initialization'''&lt;br /&gt;
If you opt for the lazy instantiation paradigm, then the singleton variable will not get memory until the property or function designated to return the reference is first called. This type of instantiation is very helpful if your singleton class is resource intense.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:5.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In order to make it thread-safe, One way is the use of double-checked locking. In double-checked locking, synchronization is only effective when the singleton variable is null, i.e., only for the first time call to Instance.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:6.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization'''&lt;br /&gt;
In static initialization, memory is allocated to the variable at the time it is declared. The instance creation takes place behind the scenes when any of the member singleton classes is accessed for the first time. The main advantage of this type of implementation is that the CLR automatically takes care of race conditions I explained in lazy instantiation. We don't have to use any special synchronization constructs here.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:7.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Inheriting a singleton class should be prohibited.&lt;br /&gt;
* Singleton takes over static classes on the following shortcomings:&lt;br /&gt;
  - Static classes don’t promote inheritance. If your class has some interface to derive from, static classes makes it impossible.&lt;br /&gt;
  - You cannot specify any creation logic with static methods. &lt;br /&gt;
  - Static methods are procedural code.&lt;br /&gt;
&lt;br /&gt;
'''Negative sides of Singleton''':&lt;br /&gt;
* They deviate from the Single Responsibility Principle. A singleton class has the responsibility to create an instance of itself along with other business responsibilities. However, this issue can be solved by delegating the creation part to a factory object.&lt;br /&gt;
* Singleton classes cannot be sub classed.&lt;br /&gt;
* Singletons can hide dependencies. One of the features of an efficient system architecture is minimizing dependencies between classes. This will in turn help you while conducting unit tests and while isolating any part of the program to a separate assembly.&lt;br /&gt;
&lt;br /&gt;
However, it is commonly accepted that the singleton can yield best results in a situation where various parts of an application concurrently try to access a shared resource. An example of a shared resource would be Logger, Print Spooler, etc. When designing a singleton, consider the following points:&lt;br /&gt;
* Singleton classes must be memory-leak free. The instance of the singleton class is to be created once and it remains for the lifetime of the application.&lt;br /&gt;
* A real singleton class is not easily extensible.&lt;br /&gt;
* Derive the singleton class from an interface. This helps while doing unit testing (using Dependency Injection).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
== [http://c2.com/cgi/wiki?SingletonPattern Singleton explained on c2.com]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Simulation of global variables, Appropriate Use of Singleton, Singleton in threaded environment&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly explains aspects like testing, creational logic,polymorphism involved in singleton pattern.It explains situations when singleton pattern can be used.It goes on to explain the anti-pattern of singletons simulating global variables and appropriate use of singleton in mutithreaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Problem of using Singleton in Multithreaded Environment''' : &lt;br /&gt;
&lt;br /&gt;
 static private synchronized Singleton instance_helper(){&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;quot;_instance&amp;quot; can be null in the logic for multiple threads before instance_helper is called, leading to multiple instances being created&lt;br /&gt;
&lt;br /&gt;
'''Solution for Singleton in Multithreaded Environment''' : &lt;br /&gt;
 &lt;br /&gt;
 static private synchronized Singleton instance_helper()&lt;br /&gt;
 {&lt;br /&gt;
 if(flag)&lt;br /&gt;
 {&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 flag = false;&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
== [http://www.oodesign.com/singleton-pattern.html Singleton Applications]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Motivation, Intent, Implementation, Applicability and Examples&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link gives some extra information about applicability of Singleton in logger classes,configuration classes, accessing resources in shared environment,factories implemented as Singleton,Implementations and problems involved&lt;br /&gt;
&lt;br /&gt;
'''Serialization''' :&lt;br /&gt;
&lt;br /&gt;
If the Singleton class implements the java.io.Serializable interface, when a singleton is serialized and then deserialized more than once, there will be multiple instances of Singleton created. In order to avoid this the readResolve method should be implemented. &lt;br /&gt;
&lt;br /&gt;
 public class Singleton implements Serializable {&lt;br /&gt;
 ...&lt;br /&gt;
 // This method is called immediately after an object of this class is deserialized.&lt;br /&gt;
 // This method returns the singleton instance.&lt;br /&gt;
 protected Object readResolve() {&lt;br /&gt;
 return getInstance();&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[http://msdn.microsoft.com/en-us/library/ff650316.aspx Singleton Implementation in C#]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Implementation in C#&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link explains how to implement a singleton in C# both in static and threaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization''':&lt;br /&gt;
&lt;br /&gt;
One of the reasons Design Patterns [Gamma95] avoided static initialization is because the C++ specification left some ambiguity around the initialization order of static variables. Fortunately, the .NET Framework resolves this ambiguity through its handling of variable initialization:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 public sealed class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static readonly Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton(){}&lt;br /&gt;
 public static Singleton Instance&lt;br /&gt;
 {&lt;br /&gt;
 get &lt;br /&gt;
 { &lt;br /&gt;
 return instance; &lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing Singleton in C# results in the following benefits and liabilities:&lt;br /&gt;
&lt;br /&gt;
'''Benefits''':&lt;br /&gt;
*The static initialization approach is possible because the .NET Framework explicitly defines how and when static variable initialization occurs.&lt;br /&gt;
*The Double-Check Locking idiom described earlier in &amp;quot;Multithreaded Singleton&amp;quot; is implemented correctly in the common language runtime.&lt;br /&gt;
&lt;br /&gt;
'''Liabilities''':&lt;br /&gt;
If your multithreaded application requires explicit initialization, you have to take precautions to avoid threading issues.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html Refactor Singleton Out Of Your Code]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Solution to refactor singleton&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Gang of Four mentions Singleton as an anti-pattern and not as a pattern. This Link provides a solution to refactor Singleton out of the code&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
'''Steps to refactor Singleton:'''&lt;br /&gt;
* Create simple interface for Registry with two simple methods - getter and setter for instance of class which is currently implemented as singleton.&lt;br /&gt;
 public interface ISingletonRegistry {&lt;br /&gt;
 SingletonClass getSingletonClass();&lt;br /&gt;
 void setSingletonClass(SingletonClass singleton);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Make SingletonClass's constructor public&lt;br /&gt;
&lt;br /&gt;
* Then implement the interface as a simplest Registry design pattern implementation - SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
 public class SingletonRegistry implements ISingletonRegistry {&lt;br /&gt;
 private static final SingletonRegistry INSTANCE = new SingletonRegistry();&lt;br /&gt;
 private SingletonClass singleton;&lt;br /&gt;
 public static ISingletonRegistry getInstance() {&lt;br /&gt;
 return INSTANCE;&lt;br /&gt;
 }&lt;br /&gt;
 private SingletonRegistry() {&lt;br /&gt;
 //this is the reason why the constructor should be public&lt;br /&gt;
 singleton = new SingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
 public SingletonClass getSingletonClass() {&lt;br /&gt;
 return singleton;&lt;br /&gt;
 }&lt;br /&gt;
 public void setSingletonClass(SingletonClass singleton) {&lt;br /&gt;
 this.singleton = singleton;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Change getInstance method of SingletonClass to get instance from SingletonRegistry.&lt;br /&gt;
 public static SingletonClass getInstance() {&lt;br /&gt;
 return SingletonRegistry.getInstance().getSingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The method getInstance from SingletonClass disappears and all it's client classes uses SingletonRegistry to access SingletonClass.&lt;br /&gt;
 public class Client {&lt;br /&gt;
 public void clientMethod() {&lt;br /&gt;
 SingletonRegistry.getInstance() .getSingletonClass().voidMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 Object object = SingletonRegistry.getInstance() .getSingletonClass().objectMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Delete INSTANCE constant from SingletonClass class.&lt;br /&gt;
&lt;br /&gt;
* You can Extract Interface (Alt+Shift+T, E) from SingletonClass. Write just new interface name, select all methods from SingletonClass which you can extract into new interface and press OK. All references to SingletonClass will be refactored to references to your newly created interface.&lt;br /&gt;
&lt;br /&gt;
And that is all. Now you have SingletonClass with totally same functionality but you are able to mock it, extend or replace by different implementation setting up your instance of SingletonClass to SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
== [http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern/ Refactoring:Extracting the Singleton Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Extracting the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Here, the author demonstrates the refactoring of Singleton Pattern by means of an example of a Device Manger class. So the main class that will be changing is the DeviceManager. This class manages a collection of Devices (or a dictionary, to be more precise) and allows to set which is the active device and to get a device by id. Note that this last feature could be handled by the Devices collection, but we are taking advantage of the dictionary to make that look-up more efficient.&lt;br /&gt;
&lt;br /&gt;
== [http://www.roseindia.net/designpattern/singleton_pattern.shtml Singleton Pattern Usage and Benefits]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Usage, Benefits, Example&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and usage in multithreaded environment.Singleton patterns are often used as global variables because the global variables permit allocation and initialization whenever required. They don't permit to pollute the global namespace with unnecessary variables.&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
 package singleton;&lt;br /&gt;
 public class Logger {&lt;br /&gt;
 private String fileName;&lt;br /&gt;
 private Properties properties;&lt;br /&gt;
 private Priority priority;&lt;br /&gt;
 private Logger() {&lt;br /&gt;
 logger = this;&lt;br /&gt;
 }&lt;br /&gt;
 public int getRegisteredLevel() {&lt;br /&gt;
 int i = 0;&lt;br /&gt;
 try {&lt;br /&gt;
 InputStream inputstream = getClass().getResourceAsStream(&amp;quot;Logger.properties&amp;quot;);&lt;br /&gt;
 properties.load(inputstream);&lt;br /&gt;
 inputstream.close();&lt;br /&gt;
 i = Integer.parseInt(properties.getProperty(&amp;quot;logger.registeredlevel&amp;quot;));&lt;br /&gt;
 if(i &amp;lt; 0 || i &amp;gt; 3)&lt;br /&gt;
 i = 0;&lt;br /&gt;
 }&lt;br /&gt;
 catch(Exception exception) {&lt;br /&gt;
 System.out.println(&amp;quot;Logger: Failed in the getRegisteredLevel method&amp;quot;);&lt;br /&gt;
 exception.printStackTrace();&lt;br /&gt;
 }&lt;br /&gt;
 return i;&lt;br /&gt;
 }&lt;br /&gt;
 public static void initialize() {&lt;br /&gt;
 logger = new Logger();&lt;br /&gt;
 }&lt;br /&gt;
 // singleton - pattern&lt;br /&gt;
 private static Logger logger;&lt;br /&gt;
 public static Logger getLogger() {&lt;br /&gt;
 return logger;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== [http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern Critique of the Singleton Pattern]==&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Critique of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and flexibility and drawbacks like overhead, development confusion and Object lifetime while using the singleton pattern.&lt;br /&gt;
&lt;br /&gt;
==[http://www.ibm.com/developerworks/webservices/library/co-single/index.html Use Singletons Wisely]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
When to use, Moving away from Singletons, Aggregating Singletons&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The programming community discourages using global data and objects. Still, there are times when an application needs a single instance of a given class and a global point of access to that class. The general solution is the design pattern known as singletons. However, singletons are unnecessarily difficult to test and may make strong assumptions about the applications that will use them. In this article the author discusses strategies for avoiding the singleton pattern for that majority of cases where it is not appropriate. He also describes the properties of some classes that are truly singletons.&lt;br /&gt;
&lt;br /&gt;
'''Aggregating Singletons: The Toolbox''':&lt;br /&gt;
Singleton abuse can be avoided by looking at the problem from a different angle. Suppose an application needs only one instance of a class and the application configures that class at startup: Why should the class itself be responsible for being a singleton? It seems quite logical for the application to take on this responsibility, since the application requires this kind of behavior. The application, not the component, should be the singleton. The application then makes an instance of the component available for any application-specific code to use. When an application uses several such components, it can aggregate them into what we have called a toolbox.&lt;br /&gt;
Put simply, the application's toolbox is a singleton that is responsible either for configuring itself or for allowing the application's startup mechanism to configure it. The general pattern of the Toolbox singleton is as shown in the example provided in this article&lt;br /&gt;
The Toolbox is itself a singleton, and it manages the lifetime of the various component instances. Either the application configures it, or it asks the application for configuration information in method initialize. Now the application can decide how many instances of which classes it requires. Changes in those decisions may affect application-specific code, but not reusable, infrastructure-level code. Moreover, testing infrastructure code is much easier, as those classes do not rely on the way in which any application may choose to use them.&lt;br /&gt;
&lt;br /&gt;
== [http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious When Not to Use Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Appropriate Use of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The Gang of Four states that you'll want to use Singleton there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point or when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx&lt;br /&gt;
&lt;br /&gt;
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html&lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/singleton&lt;br /&gt;
&lt;br /&gt;
http://c2.com/cgi/wiki?SingletonPattern&lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/singleton-pattern.html&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/en-us/library/ff650316.aspx&lt;br /&gt;
&lt;br /&gt;
http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html&lt;br /&gt;
&lt;br /&gt;
http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern&lt;br /&gt;
&lt;br /&gt;
http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern&lt;br /&gt;
&lt;br /&gt;
http://www.roseindia.net/designpattern/singleton_pattern.shtml&lt;br /&gt;
&lt;br /&gt;
http://www.ibm.com/developerworks/webservices/library/co-single/index.html&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70848</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70848"/>
		<updated>2012-11-19T22:44:27Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Positive and Negative aspects of Singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, Directory of Sites=&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:3.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html Simply Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Capabilities of Singleton pattern,Singleton design pattern class diagram, Example, use of protected constructors.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
The Singleton design pattern addresses all of the previous paragraph's concerns. With the Singleton design pattern you can:&lt;br /&gt;
* Ensure that only one instance of a class is created.&lt;br /&gt;
* Provide a global point of access to the object.&lt;br /&gt;
* Allow multiple instances in the future without affecting a singleton class's clients.&lt;br /&gt;
&lt;br /&gt;
As in , [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html#resources Design Patterns], &amp;quot;Ensure a class has a single instance, and provide a global point of access to it&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:4.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Other than the lazy initialization process, a classicSingleton class can also implement a protected constructor so client cannot instantiate ClassicSingleton instances; however, you may be surprised to discover that the following code is perfectly legal:&lt;br /&gt;
&lt;br /&gt;
 public class SingletonInstantiator { &lt;br /&gt;
 public SingletonInstantiator() { &lt;br /&gt;
 ClassicSingleton instance = ClassicSingleton.getInstance();&lt;br /&gt;
 ClassicSingleton anotherInstance =&lt;br /&gt;
 new ClassicSingleton();&lt;br /&gt;
 ... &lt;br /&gt;
  } &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Protected constructors can be called by subclasses and by other classes in the same package. Because ClassicSingleton and SingletonInstantiator are in the same package (the default package), SingletonInstantiator() methods can create ClassicSingleton instances. This dilemma has two solutions: You can make the ClassicSingleton constructor private so that only ClassicSingleton() methods call it; however, that means ClassicSingleton cannot be subclassed. Sometimes, that is a desirable solution; if so, it's a good idea to declare your singleton class final, which makes that intention explicit and allows the compiler to apply performance optimizations. The other solution is to put your singleton class in an explicit package, so classes in other packages (including the default package) cannot instantiate singleton instances.&lt;br /&gt;
&lt;br /&gt;
== [http://javapapers.com/design-patterns/singleton-pattern/ JavaPaper on Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Strategy for Singleton instance creation, Early and lazy instantiation in singleton pattern, Singleton and Serialization&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
There are only two points in the definition of a singleton design pattern,&lt;br /&gt;
* There should be only one instance allowed for a class and&lt;br /&gt;
* We should allow global point of access to that single instance.&lt;br /&gt;
&lt;br /&gt;
The key is not the problem and definition. In singleton pattern, trickier part is implementation and management of that single instance.&lt;br /&gt;
&lt;br /&gt;
We suppress the constructor and don’t allow even a single instance for the class. But we declare an attribute for that same class inside and create instance for that and return it. [http://javapapers.com/design-patterns/abstract-factory-pattern/ Factory design pattern] can be used to create the singleton instance.&lt;br /&gt;
&lt;br /&gt;
You need to be careful with multiple threads. If you don’t synchronize the method which is going to return the instance then, there is a possibility of allowing multiple instances in a multi-threaded scenario. Do the synchronization at block level considering the performance issues. In the below example for singleton pattern, you can see that it is threadsafe.&lt;br /&gt;
&lt;br /&gt;
 package com.javapapers.sample.designpattern;&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static Singleton singleInstance;&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getSingleInstance() {&lt;br /&gt;
 if (singleInstance == null) {&lt;br /&gt;
    synchronized (Singleton.class) {&lt;br /&gt;
      if (singleInstance == null) {&lt;br /&gt;
        singleInstance = new Singleton();&lt;br /&gt;
       }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    return singleInstance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Singleton and Serialization''' : Using [http://javapapers.com/core-java/java-serialization/ serialization], single instance contract of the singleton pattern can be violated. You can serialize and de-serialize and get a new instance of the same singleton class. Using java api, you can implement the below method and override the instance read from the stream. So that you can always ensure that you have single instance.&lt;br /&gt;
&lt;br /&gt;
 ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;&lt;br /&gt;
&lt;br /&gt;
'''Usage of Singleton Pattern in Java API''': &lt;br /&gt;
&lt;br /&gt;
 java.lang.Runtime#getRuntime() &lt;br /&gt;
 java.awt.Desktop#getDesktop()&lt;br /&gt;
&lt;br /&gt;
== [http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects Positive and Negative aspects of Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Introduction, Positive sides of Singleton, Lazy and Static initialization, Negative sides of Singleton, When to use a Singleton class.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
positive sides: The anatomy of a singleton class is very simple to understand. The class typically has a private constructor which will prohibit you to make any instance of the singleton class; instead you will access a static property or static function of the singleton class to get the reference of a preconfigured instance. These properties/methods ensure that there will be only one instance of the singleton class throughout the lifetime of the application.&lt;br /&gt;
&lt;br /&gt;
The one and only instance of a singleton class is created within the singleton class and its reference is consumed by the callers. The creation process of the instance can be done using any of the following methods:&lt;br /&gt;
&lt;br /&gt;
'''Lazy Initialization'''&lt;br /&gt;
If you opt for the lazy instantiation paradigm, then the singleton variable will not get memory until the property or function designated to return the reference is first called. This type of instantiation is very helpful if your singleton class is resource intense.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:5.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In order to make it thread-safe, One way is the use of double-checked locking. In double-checked locking, synchronization is only effective when the singleton variable is null, i.e., only for the first time call to Instance.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:6.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization'''&lt;br /&gt;
In static initialization, memory is allocated to the variable at the time it is declared. The instance creation takes place behind the scenes when any of the member singleton classes is accessed for the first time. The main advantage of this type of implementation is that the CLR automatically takes care of race conditions I explained in lazy instantiation. We don't have to use any special synchronization constructs here.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:7.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Inheriting a singleton class should be prohibited.&lt;br /&gt;
* Singleton takes over static classes on the following shortcomings:&lt;br /&gt;
- Static classes don’t promote inheritance. If your class has some interface to derive from, static classes makes it impossible.&lt;br /&gt;
- You cannot specify any creation logic with static methods.&lt;br /&gt;
- Static methods are procedural code.&lt;br /&gt;
&lt;br /&gt;
'''Negative sides of Singleton''':&lt;br /&gt;
* They deviate from the Single Responsibility Principle. A singleton class has the responsibility to create an instance of itself along with other business responsibilities. However, this issue can be solved by delegating the creation part to a factory object.&lt;br /&gt;
* Singleton classes cannot be sub classed.&lt;br /&gt;
* Singletons can hide dependencies. One of the features of an efficient system architecture is minimizing dependencies between classes. This will in turn help you while conducting unit tests and while isolating any part of the program to a separate assembly.&lt;br /&gt;
&lt;br /&gt;
However, it is commonly accepted that the singleton can yield best results in a situation where various parts of an application concurrently try to access a shared resource. An example of a shared resource would be Logger, Print Spooler, etc. When designing a singleton, consider the following points:&lt;br /&gt;
* Singleton classes must be memory-leak free. The instance of the singleton class is to be created once and it remains for the lifetime of the application.&lt;br /&gt;
* A real singleton class is not easily extensible.&lt;br /&gt;
* Derive the singleton class from an interface. This helps while doing unit testing (using Dependency Injection).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
== [http://c2.com/cgi/wiki?SingletonPattern Singleton explained on c2.com]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Simulation of global variables, Appropriate Use of Singleton, Singleton in threaded environment&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly explains aspects like testing, creational logic,polymorphism involved in singleton pattern.It explains situations when singleton pattern can be used.It goes on to explain the anti-pattern of singletons simulating global variables and appropriate use of singleton in mutithreaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Problem of using Singleton in Multithreaded Environment''' : &lt;br /&gt;
&lt;br /&gt;
 static private synchronized Singleton instance_helper(){&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;quot;_instance&amp;quot; can be null in the logic for multiple threads before instance_helper is called, leading to multiple instances being created&lt;br /&gt;
&lt;br /&gt;
'''Solution for Singleton in Multithreaded Environment''' : &lt;br /&gt;
 &lt;br /&gt;
 static private synchronized Singleton instance_helper()&lt;br /&gt;
 {&lt;br /&gt;
 if(flag)&lt;br /&gt;
 {&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 flag = false;&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
== [http://www.oodesign.com/singleton-pattern.html Singleton Applications]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Motivation, Intent, Implementation, Applicability and Examples&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link gives some extra information about applicability of Singleton in logger classes,configuration classes, accessing resources in shared environment,factories implemented as Singleton,Implementations and problems involved&lt;br /&gt;
&lt;br /&gt;
'''Serialization''' :&lt;br /&gt;
&lt;br /&gt;
If the Singleton class implements the java.io.Serializable interface, when a singleton is serialized and then deserialized more than once, there will be multiple instances of Singleton created. In order to avoid this the readResolve method should be implemented. &lt;br /&gt;
&lt;br /&gt;
 public class Singleton implements Serializable {&lt;br /&gt;
 ...&lt;br /&gt;
 // This method is called immediately after an object of this class is deserialized.&lt;br /&gt;
 // This method returns the singleton instance.&lt;br /&gt;
 protected Object readResolve() {&lt;br /&gt;
 return getInstance();&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[http://msdn.microsoft.com/en-us/library/ff650316.aspx Singleton Implementation in C#]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Implementation in C#&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link explains how to implement a singleton in C# both in static and threaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization''':&lt;br /&gt;
&lt;br /&gt;
One of the reasons Design Patterns [Gamma95] avoided static initialization is because the C++ specification left some ambiguity around the initialization order of static variables. Fortunately, the .NET Framework resolves this ambiguity through its handling of variable initialization:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 public sealed class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static readonly Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton(){}&lt;br /&gt;
 public static Singleton Instance&lt;br /&gt;
 {&lt;br /&gt;
 get &lt;br /&gt;
 { &lt;br /&gt;
 return instance; &lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing Singleton in C# results in the following benefits and liabilities:&lt;br /&gt;
&lt;br /&gt;
'''Benefits''':&lt;br /&gt;
*The static initialization approach is possible because the .NET Framework explicitly defines how and when static variable initialization occurs.&lt;br /&gt;
*The Double-Check Locking idiom described earlier in &amp;quot;Multithreaded Singleton&amp;quot; is implemented correctly in the common language runtime.&lt;br /&gt;
&lt;br /&gt;
'''Liabilities''':&lt;br /&gt;
If your multithreaded application requires explicit initialization, you have to take precautions to avoid threading issues.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html Refactor Singleton Out Of Your Code]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Solution to refactor singleton&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Gang of Four mentions Singleton as an anti-pattern and not as a pattern. This Link provides a solution to refactor Singleton out of the code&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
'''Steps to refactor Singleton:'''&lt;br /&gt;
* Create simple interface for Registry with two simple methods - getter and setter for instance of class which is currently implemented as singleton.&lt;br /&gt;
 public interface ISingletonRegistry {&lt;br /&gt;
 SingletonClass getSingletonClass();&lt;br /&gt;
 void setSingletonClass(SingletonClass singleton);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Make SingletonClass's constructor public&lt;br /&gt;
&lt;br /&gt;
* Then implement the interface as a simplest Registry design pattern implementation - SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
 public class SingletonRegistry implements ISingletonRegistry {&lt;br /&gt;
 private static final SingletonRegistry INSTANCE = new SingletonRegistry();&lt;br /&gt;
 private SingletonClass singleton;&lt;br /&gt;
 public static ISingletonRegistry getInstance() {&lt;br /&gt;
 return INSTANCE;&lt;br /&gt;
 }&lt;br /&gt;
 private SingletonRegistry() {&lt;br /&gt;
 //this is the reason why the constructor should be public&lt;br /&gt;
 singleton = new SingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
 public SingletonClass getSingletonClass() {&lt;br /&gt;
 return singleton;&lt;br /&gt;
 }&lt;br /&gt;
 public void setSingletonClass(SingletonClass singleton) {&lt;br /&gt;
 this.singleton = singleton;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Change getInstance method of SingletonClass to get instance from SingletonRegistry.&lt;br /&gt;
 public static SingletonClass getInstance() {&lt;br /&gt;
 return SingletonRegistry.getInstance().getSingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The method getInstance from SingletonClass disappears and all it's client classes uses SingletonRegistry to access SingletonClass.&lt;br /&gt;
 public class Client {&lt;br /&gt;
 public void clientMethod() {&lt;br /&gt;
 SingletonRegistry.getInstance() .getSingletonClass().voidMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 Object object = SingletonRegistry.getInstance() .getSingletonClass().objectMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Delete INSTANCE constant from SingletonClass class.&lt;br /&gt;
&lt;br /&gt;
* You can Extract Interface (Alt+Shift+T, E) from SingletonClass. Write just new interface name, select all methods from SingletonClass which you can extract into new interface and press OK. All references to SingletonClass will be refactored to references to your newly created interface.&lt;br /&gt;
&lt;br /&gt;
And that is all. Now you have SingletonClass with totally same functionality but you are able to mock it, extend or replace by different implementation setting up your instance of SingletonClass to SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
== [http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern/ Refactoring:Extracting the Singleton Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Extracting the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Here, the author demonstrates the refactoring of Singleton Pattern by means of an example of a Device Manger class. So the main class that will be changing is the DeviceManager. This class manages a collection of Devices (or a dictionary, to be more precise) and allows to set which is the active device and to get a device by id. Note that this last feature could be handled by the Devices collection, but we are taking advantage of the dictionary to make that look-up more efficient.&lt;br /&gt;
&lt;br /&gt;
== [http://www.roseindia.net/designpattern/singleton_pattern.shtml Singleton Pattern Usage and Benefits]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Usage, Benefits, Example&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and usage in multithreaded environment.Singleton patterns are often used as global variables because the global variables permit allocation and initialization whenever required. They don't permit to pollute the global namespace with unnecessary variables.&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
 package singleton;&lt;br /&gt;
 public class Logger {&lt;br /&gt;
 private String fileName;&lt;br /&gt;
 private Properties properties;&lt;br /&gt;
 private Priority priority;&lt;br /&gt;
 private Logger() {&lt;br /&gt;
 logger = this;&lt;br /&gt;
 }&lt;br /&gt;
 public int getRegisteredLevel() {&lt;br /&gt;
 int i = 0;&lt;br /&gt;
 try {&lt;br /&gt;
 InputStream inputstream = getClass().getResourceAsStream(&amp;quot;Logger.properties&amp;quot;);&lt;br /&gt;
 properties.load(inputstream);&lt;br /&gt;
 inputstream.close();&lt;br /&gt;
 i = Integer.parseInt(properties.getProperty(&amp;quot;logger.registeredlevel&amp;quot;));&lt;br /&gt;
 if(i &amp;lt; 0 || i &amp;gt; 3)&lt;br /&gt;
 i = 0;&lt;br /&gt;
 }&lt;br /&gt;
 catch(Exception exception) {&lt;br /&gt;
 System.out.println(&amp;quot;Logger: Failed in the getRegisteredLevel method&amp;quot;);&lt;br /&gt;
 exception.printStackTrace();&lt;br /&gt;
 }&lt;br /&gt;
 return i;&lt;br /&gt;
 }&lt;br /&gt;
 public static void initialize() {&lt;br /&gt;
 logger = new Logger();&lt;br /&gt;
 }&lt;br /&gt;
 // singleton - pattern&lt;br /&gt;
 private static Logger logger;&lt;br /&gt;
 public static Logger getLogger() {&lt;br /&gt;
 return logger;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== [http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern Critique of the Singleton Pattern]==&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Critique of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and flexibility and drawbacks like overhead, development confusion and Object lifetime while using the singleton pattern.&lt;br /&gt;
&lt;br /&gt;
==[http://www.ibm.com/developerworks/webservices/library/co-single/index.html Use Singletons Wisely]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
When to use, Moving away from Singletons, Aggregating Singletons&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The programming community discourages using global data and objects. Still, there are times when an application needs a single instance of a given class and a global point of access to that class. The general solution is the design pattern known as singletons. However, singletons are unnecessarily difficult to test and may make strong assumptions about the applications that will use them. In this article the author discusses strategies for avoiding the singleton pattern for that majority of cases where it is not appropriate. He also describes the properties of some classes that are truly singletons.&lt;br /&gt;
&lt;br /&gt;
'''Aggregating Singletons: The Toolbox''':&lt;br /&gt;
Singleton abuse can be avoided by looking at the problem from a different angle. Suppose an application needs only one instance of a class and the application configures that class at startup: Why should the class itself be responsible for being a singleton? It seems quite logical for the application to take on this responsibility, since the application requires this kind of behavior. The application, not the component, should be the singleton. The application then makes an instance of the component available for any application-specific code to use. When an application uses several such components, it can aggregate them into what we have called a toolbox.&lt;br /&gt;
Put simply, the application's toolbox is a singleton that is responsible either for configuring itself or for allowing the application's startup mechanism to configure it. The general pattern of the Toolbox singleton is as shown in the example provided in this article&lt;br /&gt;
The Toolbox is itself a singleton, and it manages the lifetime of the various component instances. Either the application configures it, or it asks the application for configuration information in method initialize. Now the application can decide how many instances of which classes it requires. Changes in those decisions may affect application-specific code, but not reusable, infrastructure-level code. Moreover, testing infrastructure code is much easier, as those classes do not rely on the way in which any application may choose to use them.&lt;br /&gt;
&lt;br /&gt;
== [http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious When Not to Use Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Appropriate Use of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The Gang of Four states that you'll want to use Singleton there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point or when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx&lt;br /&gt;
&lt;br /&gt;
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html&lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/singleton&lt;br /&gt;
&lt;br /&gt;
http://c2.com/cgi/wiki?SingletonPattern&lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/singleton-pattern.html&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/en-us/library/ff650316.aspx&lt;br /&gt;
&lt;br /&gt;
http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html&lt;br /&gt;
&lt;br /&gt;
http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern&lt;br /&gt;
&lt;br /&gt;
http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern&lt;br /&gt;
&lt;br /&gt;
http://www.roseindia.net/designpattern/singleton_pattern.shtml&lt;br /&gt;
&lt;br /&gt;
http://www.ibm.com/developerworks/webservices/library/co-single/index.html&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70843</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70843"/>
		<updated>2012-11-19T22:43:04Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Positive and Negative aspects of Singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, Directory of Sites=&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:3.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html Simply Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Capabilities of Singleton pattern,Singleton design pattern class diagram, Example, use of protected constructors.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
The Singleton design pattern addresses all of the previous paragraph's concerns. With the Singleton design pattern you can:&lt;br /&gt;
* Ensure that only one instance of a class is created.&lt;br /&gt;
* Provide a global point of access to the object.&lt;br /&gt;
* Allow multiple instances in the future without affecting a singleton class's clients.&lt;br /&gt;
&lt;br /&gt;
As in , [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html#resources Design Patterns], &amp;quot;Ensure a class has a single instance, and provide a global point of access to it&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:4.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Other than the lazy initialization process, a classicSingleton class can also implement a protected constructor so client cannot instantiate ClassicSingleton instances; however, you may be surprised to discover that the following code is perfectly legal:&lt;br /&gt;
&lt;br /&gt;
 public class SingletonInstantiator { &lt;br /&gt;
 public SingletonInstantiator() { &lt;br /&gt;
 ClassicSingleton instance = ClassicSingleton.getInstance();&lt;br /&gt;
 ClassicSingleton anotherInstance =&lt;br /&gt;
 new ClassicSingleton();&lt;br /&gt;
 ... &lt;br /&gt;
  } &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Protected constructors can be called by subclasses and by other classes in the same package. Because ClassicSingleton and SingletonInstantiator are in the same package (the default package), SingletonInstantiator() methods can create ClassicSingleton instances. This dilemma has two solutions: You can make the ClassicSingleton constructor private so that only ClassicSingleton() methods call it; however, that means ClassicSingleton cannot be subclassed. Sometimes, that is a desirable solution; if so, it's a good idea to declare your singleton class final, which makes that intention explicit and allows the compiler to apply performance optimizations. The other solution is to put your singleton class in an explicit package, so classes in other packages (including the default package) cannot instantiate singleton instances.&lt;br /&gt;
&lt;br /&gt;
== [http://javapapers.com/design-patterns/singleton-pattern/ JavaPaper on Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Strategy for Singleton instance creation, Early and lazy instantiation in singleton pattern, Singleton and Serialization&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
There are only two points in the definition of a singleton design pattern,&lt;br /&gt;
* There should be only one instance allowed for a class and&lt;br /&gt;
* We should allow global point of access to that single instance.&lt;br /&gt;
&lt;br /&gt;
The key is not the problem and definition. In singleton pattern, trickier part is implementation and management of that single instance.&lt;br /&gt;
&lt;br /&gt;
We suppress the constructor and don’t allow even a single instance for the class. But we declare an attribute for that same class inside and create instance for that and return it. [http://javapapers.com/design-patterns/abstract-factory-pattern/ Factory design pattern] can be used to create the singleton instance.&lt;br /&gt;
&lt;br /&gt;
You need to be careful with multiple threads. If you don’t synchronize the method which is going to return the instance then, there is a possibility of allowing multiple instances in a multi-threaded scenario. Do the synchronization at block level considering the performance issues. In the below example for singleton pattern, you can see that it is threadsafe.&lt;br /&gt;
&lt;br /&gt;
 package com.javapapers.sample.designpattern;&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static Singleton singleInstance;&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getSingleInstance() {&lt;br /&gt;
 if (singleInstance == null) {&lt;br /&gt;
    synchronized (Singleton.class) {&lt;br /&gt;
      if (singleInstance == null) {&lt;br /&gt;
        singleInstance = new Singleton();&lt;br /&gt;
       }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    return singleInstance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Singleton and Serialization''' : Using [http://javapapers.com/core-java/java-serialization/ serialization], single instance contract of the singleton pattern can be violated. You can serialize and de-serialize and get a new instance of the same singleton class. Using java api, you can implement the below method and override the instance read from the stream. So that you can always ensure that you have single instance.&lt;br /&gt;
&lt;br /&gt;
 ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;&lt;br /&gt;
&lt;br /&gt;
'''Usage of Singleton Pattern in Java API''': &lt;br /&gt;
&lt;br /&gt;
 java.lang.Runtime#getRuntime() &lt;br /&gt;
 java.awt.Desktop#getDesktop()&lt;br /&gt;
&lt;br /&gt;
== [http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects Positive and Negative aspects of Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Introduction, Positive sides of Singleton, Lazy and Static initialization, Negative sides of Singleton, When to use a Singleton class.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
positive sides: The anatomy of a singleton class is very simple to understand. The class typically has a private constructor which will prohibit you to make any instance of the singleton class; instead you will access a static property or static function of the singleton class to get the reference of a preconfigured instance. These properties/methods ensure that there will be only one instance of the singleton class throughout the lifetime of the application.&lt;br /&gt;
&lt;br /&gt;
The one and only instance of a singleton class is created within the singleton class and its reference is consumed by the callers. The creation process of the instance can be done using any of the following methods:&lt;br /&gt;
&lt;br /&gt;
'''Lazy Initialization'''&lt;br /&gt;
If you opt for the lazy instantiation paradigm, then the singleton variable will not get memory until the property or function designated to return the reference is first called. This type of instantiation is very helpful if your singleton class is resource intense.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:5.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In order to make it thread-safe, One way is the use of double-checked locking. In double-checked locking, synchronization is only effective when the singleton variable is null, i.e., only for the first time call to Instance.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:6.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization'''&lt;br /&gt;
In static initialization, memory is allocated to the variable at the time it is declared. The instance creation takes place behind the scenes when any of the member singleton classes is accessed for the first time. The main advantage of this type of implementation is that the CLR automatically takes care of race conditions I explained in lazy instantiation. We don't have to use any special synchronization constructs here.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:7.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Inheriting a singleton class should be prohibited.&lt;br /&gt;
* Singleton takes over static classes on the following shortcomings:&lt;br /&gt;
1. Static classes don’t promote inheritance. If your class has some interface to derive from, static classes makes it impossible.&lt;br /&gt;
2. You cannot specify any creation logic with static methods.&lt;br /&gt;
3. Static methods are procedural code.&lt;br /&gt;
&lt;br /&gt;
'''Negative sides of Singleton''':&lt;br /&gt;
1.They deviate from the Single Responsibility Principle. A singleton class has the responsibility to create an instance of itself along with other business responsibilities. However, this issue can be solved by delegating the creation part to a factory object.&lt;br /&gt;
2. Singleton classes cannot be sub classed.&lt;br /&gt;
3. Singletons can hide dependencies. One of the features of an efficient system architecture is minimizing dependencies between classes. This will in turn help you while conducting unit tests and while isolating any part of the program to a separate assembly.&lt;br /&gt;
&lt;br /&gt;
However, it is commonly accepted that the singleton can yield best results in a situation where various parts of an application concurrently try to access a shared resource. An example of a shared resource would be Logger, Print Spooler, etc. When designing a singleton, consider the following points:&lt;br /&gt;
1. Singleton classes must be memory-leak free. The instance of the singleton class is to be created once and it remains for the lifetime of the application.&lt;br /&gt;
2. A real singleton class is not easily extensible.&lt;br /&gt;
3. Derive the singleton class from an interface. This helps while doing unit testing (using Dependency Injection).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
== [http://c2.com/cgi/wiki?SingletonPattern Singleton explained on c2.com]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Simulation of global variables, Appropriate Use of Singleton, Singleton in threaded environment&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly explains aspects like testing, creational logic,polymorphism involved in singleton pattern.It explains situations when singleton pattern can be used.It goes on to explain the anti-pattern of singletons simulating global variables and appropriate use of singleton in mutithreaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Problem of using Singleton in Multithreaded Environment''' : &lt;br /&gt;
&lt;br /&gt;
 static private synchronized Singleton instance_helper(){&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;quot;_instance&amp;quot; can be null in the logic for multiple threads before instance_helper is called, leading to multiple instances being created&lt;br /&gt;
&lt;br /&gt;
'''Solution for Singleton in Multithreaded Environment''' : &lt;br /&gt;
 &lt;br /&gt;
 static private synchronized Singleton instance_helper()&lt;br /&gt;
 {&lt;br /&gt;
 if(flag)&lt;br /&gt;
 {&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 flag = false;&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
== [http://www.oodesign.com/singleton-pattern.html Singleton Applications]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Motivation, Intent, Implementation, Applicability and Examples&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link gives some extra information about applicability of Singleton in logger classes,configuration classes, accessing resources in shared environment,factories implemented as Singleton,Implementations and problems involved&lt;br /&gt;
&lt;br /&gt;
'''Serialization''' :&lt;br /&gt;
&lt;br /&gt;
If the Singleton class implements the java.io.Serializable interface, when a singleton is serialized and then deserialized more than once, there will be multiple instances of Singleton created. In order to avoid this the readResolve method should be implemented. &lt;br /&gt;
&lt;br /&gt;
 public class Singleton implements Serializable {&lt;br /&gt;
 ...&lt;br /&gt;
 // This method is called immediately after an object of this class is deserialized.&lt;br /&gt;
 // This method returns the singleton instance.&lt;br /&gt;
 protected Object readResolve() {&lt;br /&gt;
 return getInstance();&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[http://msdn.microsoft.com/en-us/library/ff650316.aspx Singleton Implementation in C#]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Implementation in C#&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link explains how to implement a singleton in C# both in static and threaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization''':&lt;br /&gt;
&lt;br /&gt;
One of the reasons Design Patterns [Gamma95] avoided static initialization is because the C++ specification left some ambiguity around the initialization order of static variables. Fortunately, the .NET Framework resolves this ambiguity through its handling of variable initialization:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 public sealed class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static readonly Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton(){}&lt;br /&gt;
 public static Singleton Instance&lt;br /&gt;
 {&lt;br /&gt;
 get &lt;br /&gt;
 { &lt;br /&gt;
 return instance; &lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing Singleton in C# results in the following benefits and liabilities:&lt;br /&gt;
&lt;br /&gt;
'''Benefits''':&lt;br /&gt;
*The static initialization approach is possible because the .NET Framework explicitly defines how and when static variable initialization occurs.&lt;br /&gt;
*The Double-Check Locking idiom described earlier in &amp;quot;Multithreaded Singleton&amp;quot; is implemented correctly in the common language runtime.&lt;br /&gt;
&lt;br /&gt;
'''Liabilities''':&lt;br /&gt;
If your multithreaded application requires explicit initialization, you have to take precautions to avoid threading issues.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html Refactor Singleton Out Of Your Code]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Solution to refactor singleton&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Gang of Four mentions Singleton as an anti-pattern and not as a pattern. This Link provides a solution to refactor Singleton out of the code&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
'''Steps to refactor Singleton:'''&lt;br /&gt;
* Create simple interface for Registry with two simple methods - getter and setter for instance of class which is currently implemented as singleton.&lt;br /&gt;
 public interface ISingletonRegistry {&lt;br /&gt;
 SingletonClass getSingletonClass();&lt;br /&gt;
 void setSingletonClass(SingletonClass singleton);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Make SingletonClass's constructor public&lt;br /&gt;
&lt;br /&gt;
* Then implement the interface as a simplest Registry design pattern implementation - SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
 public class SingletonRegistry implements ISingletonRegistry {&lt;br /&gt;
 private static final SingletonRegistry INSTANCE = new SingletonRegistry();&lt;br /&gt;
 private SingletonClass singleton;&lt;br /&gt;
 public static ISingletonRegistry getInstance() {&lt;br /&gt;
 return INSTANCE;&lt;br /&gt;
 }&lt;br /&gt;
 private SingletonRegistry() {&lt;br /&gt;
 //this is the reason why the constructor should be public&lt;br /&gt;
 singleton = new SingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
 public SingletonClass getSingletonClass() {&lt;br /&gt;
 return singleton;&lt;br /&gt;
 }&lt;br /&gt;
 public void setSingletonClass(SingletonClass singleton) {&lt;br /&gt;
 this.singleton = singleton;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Change getInstance method of SingletonClass to get instance from SingletonRegistry.&lt;br /&gt;
 public static SingletonClass getInstance() {&lt;br /&gt;
 return SingletonRegistry.getInstance().getSingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The method getInstance from SingletonClass disappears and all it's client classes uses SingletonRegistry to access SingletonClass.&lt;br /&gt;
 public class Client {&lt;br /&gt;
 public void clientMethod() {&lt;br /&gt;
 SingletonRegistry.getInstance() .getSingletonClass().voidMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 Object object = SingletonRegistry.getInstance() .getSingletonClass().objectMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Delete INSTANCE constant from SingletonClass class.&lt;br /&gt;
&lt;br /&gt;
* You can Extract Interface (Alt+Shift+T, E) from SingletonClass. Write just new interface name, select all methods from SingletonClass which you can extract into new interface and press OK. All references to SingletonClass will be refactored to references to your newly created interface.&lt;br /&gt;
&lt;br /&gt;
And that is all. Now you have SingletonClass with totally same functionality but you are able to mock it, extend or replace by different implementation setting up your instance of SingletonClass to SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
== [http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern/ Refactoring:Extracting the Singleton Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Extracting the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Here, the author demonstrates the refactoring of Singleton Pattern by means of an example of a Device Manger class. So the main class that will be changing is the DeviceManager. This class manages a collection of Devices (or a dictionary, to be more precise) and allows to set which is the active device and to get a device by id. Note that this last feature could be handled by the Devices collection, but we are taking advantage of the dictionary to make that look-up more efficient.&lt;br /&gt;
&lt;br /&gt;
== [http://www.roseindia.net/designpattern/singleton_pattern.shtml Singleton Pattern Usage and Benefits]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Usage, Benefits, Example&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and usage in multithreaded environment.Singleton patterns are often used as global variables because the global variables permit allocation and initialization whenever required. They don't permit to pollute the global namespace with unnecessary variables.&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
 package singleton;&lt;br /&gt;
 public class Logger {&lt;br /&gt;
 private String fileName;&lt;br /&gt;
 private Properties properties;&lt;br /&gt;
 private Priority priority;&lt;br /&gt;
 private Logger() {&lt;br /&gt;
 logger = this;&lt;br /&gt;
 }&lt;br /&gt;
 public int getRegisteredLevel() {&lt;br /&gt;
 int i = 0;&lt;br /&gt;
 try {&lt;br /&gt;
 InputStream inputstream = getClass().getResourceAsStream(&amp;quot;Logger.properties&amp;quot;);&lt;br /&gt;
 properties.load(inputstream);&lt;br /&gt;
 inputstream.close();&lt;br /&gt;
 i = Integer.parseInt(properties.getProperty(&amp;quot;logger.registeredlevel&amp;quot;));&lt;br /&gt;
 if(i &amp;lt; 0 || i &amp;gt; 3)&lt;br /&gt;
 i = 0;&lt;br /&gt;
 }&lt;br /&gt;
 catch(Exception exception) {&lt;br /&gt;
 System.out.println(&amp;quot;Logger: Failed in the getRegisteredLevel method&amp;quot;);&lt;br /&gt;
 exception.printStackTrace();&lt;br /&gt;
 }&lt;br /&gt;
 return i;&lt;br /&gt;
 }&lt;br /&gt;
 public static void initialize() {&lt;br /&gt;
 logger = new Logger();&lt;br /&gt;
 }&lt;br /&gt;
 // singleton - pattern&lt;br /&gt;
 private static Logger logger;&lt;br /&gt;
 public static Logger getLogger() {&lt;br /&gt;
 return logger;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== [http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern Critique of the Singleton Pattern]==&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Critique of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and flexibility and drawbacks like overhead, development confusion and Object lifetime while using the singleton pattern.&lt;br /&gt;
&lt;br /&gt;
==[http://www.ibm.com/developerworks/webservices/library/co-single/index.html Use Singletons Wisely]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
When to use, Moving away from Singletons, Aggregating Singletons&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The programming community discourages using global data and objects. Still, there are times when an application needs a single instance of a given class and a global point of access to that class. The general solution is the design pattern known as singletons. However, singletons are unnecessarily difficult to test and may make strong assumptions about the applications that will use them. In this article the author discusses strategies for avoiding the singleton pattern for that majority of cases where it is not appropriate. He also describes the properties of some classes that are truly singletons.&lt;br /&gt;
&lt;br /&gt;
'''Aggregating Singletons: The Toolbox''':&lt;br /&gt;
Singleton abuse can be avoided by looking at the problem from a different angle. Suppose an application needs only one instance of a class and the application configures that class at startup: Why should the class itself be responsible for being a singleton? It seems quite logical for the application to take on this responsibility, since the application requires this kind of behavior. The application, not the component, should be the singleton. The application then makes an instance of the component available for any application-specific code to use. When an application uses several such components, it can aggregate them into what we have called a toolbox.&lt;br /&gt;
Put simply, the application's toolbox is a singleton that is responsible either for configuring itself or for allowing the application's startup mechanism to configure it. The general pattern of the Toolbox singleton is as shown in the example provided in this article&lt;br /&gt;
The Toolbox is itself a singleton, and it manages the lifetime of the various component instances. Either the application configures it, or it asks the application for configuration information in method initialize. Now the application can decide how many instances of which classes it requires. Changes in those decisions may affect application-specific code, but not reusable, infrastructure-level code. Moreover, testing infrastructure code is much easier, as those classes do not rely on the way in which any application may choose to use them.&lt;br /&gt;
&lt;br /&gt;
== [http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious When Not to Use Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Appropriate Use of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The Gang of Four states that you'll want to use Singleton there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point or when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx&lt;br /&gt;
&lt;br /&gt;
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html&lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/singleton&lt;br /&gt;
&lt;br /&gt;
http://c2.com/cgi/wiki?SingletonPattern&lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/singleton-pattern.html&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/en-us/library/ff650316.aspx&lt;br /&gt;
&lt;br /&gt;
http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html&lt;br /&gt;
&lt;br /&gt;
http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern&lt;br /&gt;
&lt;br /&gt;
http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern&lt;br /&gt;
&lt;br /&gt;
http://www.roseindia.net/designpattern/singleton_pattern.shtml&lt;br /&gt;
&lt;br /&gt;
http://www.ibm.com/developerworks/webservices/library/co-single/index.html&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70839</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70839"/>
		<updated>2012-11-19T22:42:40Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Positive and Negative aspects of Singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, Directory of Sites=&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:3.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html Simply Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Capabilities of Singleton pattern,Singleton design pattern class diagram, Example, use of protected constructors.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
The Singleton design pattern addresses all of the previous paragraph's concerns. With the Singleton design pattern you can:&lt;br /&gt;
* Ensure that only one instance of a class is created.&lt;br /&gt;
* Provide a global point of access to the object.&lt;br /&gt;
* Allow multiple instances in the future without affecting a singleton class's clients.&lt;br /&gt;
&lt;br /&gt;
As in , [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html#resources Design Patterns], &amp;quot;Ensure a class has a single instance, and provide a global point of access to it&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:4.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Other than the lazy initialization process, a classicSingleton class can also implement a protected constructor so client cannot instantiate ClassicSingleton instances; however, you may be surprised to discover that the following code is perfectly legal:&lt;br /&gt;
&lt;br /&gt;
 public class SingletonInstantiator { &lt;br /&gt;
 public SingletonInstantiator() { &lt;br /&gt;
 ClassicSingleton instance = ClassicSingleton.getInstance();&lt;br /&gt;
 ClassicSingleton anotherInstance =&lt;br /&gt;
 new ClassicSingleton();&lt;br /&gt;
 ... &lt;br /&gt;
  } &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Protected constructors can be called by subclasses and by other classes in the same package. Because ClassicSingleton and SingletonInstantiator are in the same package (the default package), SingletonInstantiator() methods can create ClassicSingleton instances. This dilemma has two solutions: You can make the ClassicSingleton constructor private so that only ClassicSingleton() methods call it; however, that means ClassicSingleton cannot be subclassed. Sometimes, that is a desirable solution; if so, it's a good idea to declare your singleton class final, which makes that intention explicit and allows the compiler to apply performance optimizations. The other solution is to put your singleton class in an explicit package, so classes in other packages (including the default package) cannot instantiate singleton instances.&lt;br /&gt;
&lt;br /&gt;
== [http://javapapers.com/design-patterns/singleton-pattern/ JavaPaper on Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Strategy for Singleton instance creation, Early and lazy instantiation in singleton pattern, Singleton and Serialization&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
There are only two points in the definition of a singleton design pattern,&lt;br /&gt;
* There should be only one instance allowed for a class and&lt;br /&gt;
* We should allow global point of access to that single instance.&lt;br /&gt;
&lt;br /&gt;
The key is not the problem and definition. In singleton pattern, trickier part is implementation and management of that single instance.&lt;br /&gt;
&lt;br /&gt;
We suppress the constructor and don’t allow even a single instance for the class. But we declare an attribute for that same class inside and create instance for that and return it. [http://javapapers.com/design-patterns/abstract-factory-pattern/ Factory design pattern] can be used to create the singleton instance.&lt;br /&gt;
&lt;br /&gt;
You need to be careful with multiple threads. If you don’t synchronize the method which is going to return the instance then, there is a possibility of allowing multiple instances in a multi-threaded scenario. Do the synchronization at block level considering the performance issues. In the below example for singleton pattern, you can see that it is threadsafe.&lt;br /&gt;
&lt;br /&gt;
 package com.javapapers.sample.designpattern;&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static Singleton singleInstance;&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getSingleInstance() {&lt;br /&gt;
 if (singleInstance == null) {&lt;br /&gt;
    synchronized (Singleton.class) {&lt;br /&gt;
      if (singleInstance == null) {&lt;br /&gt;
        singleInstance = new Singleton();&lt;br /&gt;
       }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    return singleInstance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Singleton and Serialization''' : Using [http://javapapers.com/core-java/java-serialization/ serialization], single instance contract of the singleton pattern can be violated. You can serialize and de-serialize and get a new instance of the same singleton class. Using java api, you can implement the below method and override the instance read from the stream. So that you can always ensure that you have single instance.&lt;br /&gt;
&lt;br /&gt;
 ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;&lt;br /&gt;
&lt;br /&gt;
'''Usage of Singleton Pattern in Java API''': &lt;br /&gt;
&lt;br /&gt;
 java.lang.Runtime#getRuntime() &lt;br /&gt;
 java.awt.Desktop#getDesktop()&lt;br /&gt;
&lt;br /&gt;
== [http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects Positive and Negative aspects of Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Introduction, Positive sides of Singleton, Lazy and Static initialization, Negative sides of Singleton, When to use a Singleton class.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
positive sides: The anatomy of a singleton class is very simple to understand. The class typically has a private constructor which will prohibit you to make any instance of the singleton class; instead you will access a static property or static function of the singleton class to get the reference of a preconfigured instance. These properties/methods ensure that there will be only one instance of the singleton class throughout the lifetime of the application.&lt;br /&gt;
&lt;br /&gt;
The one and only instance of a singleton class is created within the singleton class and its reference is consumed by the callers. The creation process of the instance can be done using any of the following methods:&lt;br /&gt;
&lt;br /&gt;
'''Lazy Initialization'''&lt;br /&gt;
If you opt for the lazy instantiation paradigm, then the singleton variable will not get memory until the property or function designated to return the reference is first called. This type of instantiation is very helpful if your singleton class is resource intense.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:5.gif]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In order to make it thread-safe, One way is the use of double-checked locking. In double-checked locking, synchronization is only effective when the singleton variable is null, i.e., only for the first time call to Instance.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:6.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization'''&lt;br /&gt;
In static initialization, memory is allocated to the variable at the time it is declared. The instance creation takes place behind the scenes when any of the member singleton classes is accessed for the first time. The main advantage of this type of implementation is that the CLR automatically takes care of race conditions I explained in lazy instantiation. We don't have to use any special synchronization constructs here.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:7.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Inheriting a singleton class should be prohibited.&lt;br /&gt;
* Singleton takes over static classes on the following shortcomings:&lt;br /&gt;
1. Static classes don’t promote inheritance. If your class has some interface to derive from, static classes makes it impossible.&lt;br /&gt;
2. You cannot specify any creation logic with static methods.&lt;br /&gt;
3. Static methods are procedural code.&lt;br /&gt;
&lt;br /&gt;
'''Negative sides of Singleton''':&lt;br /&gt;
1.They deviate from the Single Responsibility Principle. A singleton class has the responsibility to create an instance of itself along with other business responsibilities. However, this issue can be solved by delegating the creation part to a factory object.&lt;br /&gt;
2. Singleton classes cannot be sub classed.&lt;br /&gt;
3. Singletons can hide dependencies. One of the features of an efficient system architecture is minimizing dependencies between classes. This will in turn help you while conducting unit tests and while isolating any part of the program to a separate assembly.&lt;br /&gt;
&lt;br /&gt;
However, it is commonly accepted that the singleton can yield best results in a situation where various parts of an application concurrently try to access a shared resource. An example of a shared resource would be Logger, Print Spooler, etc. When designing a singleton, consider the following points:&lt;br /&gt;
1. Singleton classes must be memory-leak free. The instance of the singleton class is to be created once and it remains for the lifetime of the application.&lt;br /&gt;
2. A real singleton class is not easily extensible.&lt;br /&gt;
3. Derive the singleton class from an interface. This helps while doing unit testing (using Dependency Injection).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
== [http://c2.com/cgi/wiki?SingletonPattern Singleton explained on c2.com]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Simulation of global variables, Appropriate Use of Singleton, Singleton in threaded environment&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly explains aspects like testing, creational logic,polymorphism involved in singleton pattern.It explains situations when singleton pattern can be used.It goes on to explain the anti-pattern of singletons simulating global variables and appropriate use of singleton in mutithreaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Problem of using Singleton in Multithreaded Environment''' : &lt;br /&gt;
&lt;br /&gt;
 static private synchronized Singleton instance_helper(){&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;quot;_instance&amp;quot; can be null in the logic for multiple threads before instance_helper is called, leading to multiple instances being created&lt;br /&gt;
&lt;br /&gt;
'''Solution for Singleton in Multithreaded Environment''' : &lt;br /&gt;
 &lt;br /&gt;
 static private synchronized Singleton instance_helper()&lt;br /&gt;
 {&lt;br /&gt;
 if(flag)&lt;br /&gt;
 {&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 flag = false;&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
== [http://www.oodesign.com/singleton-pattern.html Singleton Applications]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Motivation, Intent, Implementation, Applicability and Examples&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link gives some extra information about applicability of Singleton in logger classes,configuration classes, accessing resources in shared environment,factories implemented as Singleton,Implementations and problems involved&lt;br /&gt;
&lt;br /&gt;
'''Serialization''' :&lt;br /&gt;
&lt;br /&gt;
If the Singleton class implements the java.io.Serializable interface, when a singleton is serialized and then deserialized more than once, there will be multiple instances of Singleton created. In order to avoid this the readResolve method should be implemented. &lt;br /&gt;
&lt;br /&gt;
 public class Singleton implements Serializable {&lt;br /&gt;
 ...&lt;br /&gt;
 // This method is called immediately after an object of this class is deserialized.&lt;br /&gt;
 // This method returns the singleton instance.&lt;br /&gt;
 protected Object readResolve() {&lt;br /&gt;
 return getInstance();&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[http://msdn.microsoft.com/en-us/library/ff650316.aspx Singleton Implementation in C#]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Implementation in C#&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link explains how to implement a singleton in C# both in static and threaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization''':&lt;br /&gt;
&lt;br /&gt;
One of the reasons Design Patterns [Gamma95] avoided static initialization is because the C++ specification left some ambiguity around the initialization order of static variables. Fortunately, the .NET Framework resolves this ambiguity through its handling of variable initialization:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 public sealed class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static readonly Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton(){}&lt;br /&gt;
 public static Singleton Instance&lt;br /&gt;
 {&lt;br /&gt;
 get &lt;br /&gt;
 { &lt;br /&gt;
 return instance; &lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing Singleton in C# results in the following benefits and liabilities:&lt;br /&gt;
&lt;br /&gt;
'''Benefits''':&lt;br /&gt;
*The static initialization approach is possible because the .NET Framework explicitly defines how and when static variable initialization occurs.&lt;br /&gt;
*The Double-Check Locking idiom described earlier in &amp;quot;Multithreaded Singleton&amp;quot; is implemented correctly in the common language runtime.&lt;br /&gt;
&lt;br /&gt;
'''Liabilities''':&lt;br /&gt;
If your multithreaded application requires explicit initialization, you have to take precautions to avoid threading issues.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html Refactor Singleton Out Of Your Code]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Solution to refactor singleton&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Gang of Four mentions Singleton as an anti-pattern and not as a pattern. This Link provides a solution to refactor Singleton out of the code&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
'''Steps to refactor Singleton:'''&lt;br /&gt;
* Create simple interface for Registry with two simple methods - getter and setter for instance of class which is currently implemented as singleton.&lt;br /&gt;
 public interface ISingletonRegistry {&lt;br /&gt;
 SingletonClass getSingletonClass();&lt;br /&gt;
 void setSingletonClass(SingletonClass singleton);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Make SingletonClass's constructor public&lt;br /&gt;
&lt;br /&gt;
* Then implement the interface as a simplest Registry design pattern implementation - SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
 public class SingletonRegistry implements ISingletonRegistry {&lt;br /&gt;
 private static final SingletonRegistry INSTANCE = new SingletonRegistry();&lt;br /&gt;
 private SingletonClass singleton;&lt;br /&gt;
 public static ISingletonRegistry getInstance() {&lt;br /&gt;
 return INSTANCE;&lt;br /&gt;
 }&lt;br /&gt;
 private SingletonRegistry() {&lt;br /&gt;
 //this is the reason why the constructor should be public&lt;br /&gt;
 singleton = new SingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
 public SingletonClass getSingletonClass() {&lt;br /&gt;
 return singleton;&lt;br /&gt;
 }&lt;br /&gt;
 public void setSingletonClass(SingletonClass singleton) {&lt;br /&gt;
 this.singleton = singleton;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Change getInstance method of SingletonClass to get instance from SingletonRegistry.&lt;br /&gt;
 public static SingletonClass getInstance() {&lt;br /&gt;
 return SingletonRegistry.getInstance().getSingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The method getInstance from SingletonClass disappears and all it's client classes uses SingletonRegistry to access SingletonClass.&lt;br /&gt;
 public class Client {&lt;br /&gt;
 public void clientMethod() {&lt;br /&gt;
 SingletonRegistry.getInstance() .getSingletonClass().voidMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 Object object = SingletonRegistry.getInstance() .getSingletonClass().objectMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Delete INSTANCE constant from SingletonClass class.&lt;br /&gt;
&lt;br /&gt;
* You can Extract Interface (Alt+Shift+T, E) from SingletonClass. Write just new interface name, select all methods from SingletonClass which you can extract into new interface and press OK. All references to SingletonClass will be refactored to references to your newly created interface.&lt;br /&gt;
&lt;br /&gt;
And that is all. Now you have SingletonClass with totally same functionality but you are able to mock it, extend or replace by different implementation setting up your instance of SingletonClass to SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
== [http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern/ Refactoring:Extracting the Singleton Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Extracting the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Here, the author demonstrates the refactoring of Singleton Pattern by means of an example of a Device Manger class. So the main class that will be changing is the DeviceManager. This class manages a collection of Devices (or a dictionary, to be more precise) and allows to set which is the active device and to get a device by id. Note that this last feature could be handled by the Devices collection, but we are taking advantage of the dictionary to make that look-up more efficient.&lt;br /&gt;
&lt;br /&gt;
== [http://www.roseindia.net/designpattern/singleton_pattern.shtml Singleton Pattern Usage and Benefits]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Usage, Benefits, Example&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and usage in multithreaded environment.Singleton patterns are often used as global variables because the global variables permit allocation and initialization whenever required. They don't permit to pollute the global namespace with unnecessary variables.&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
 package singleton;&lt;br /&gt;
 public class Logger {&lt;br /&gt;
 private String fileName;&lt;br /&gt;
 private Properties properties;&lt;br /&gt;
 private Priority priority;&lt;br /&gt;
 private Logger() {&lt;br /&gt;
 logger = this;&lt;br /&gt;
 }&lt;br /&gt;
 public int getRegisteredLevel() {&lt;br /&gt;
 int i = 0;&lt;br /&gt;
 try {&lt;br /&gt;
 InputStream inputstream = getClass().getResourceAsStream(&amp;quot;Logger.properties&amp;quot;);&lt;br /&gt;
 properties.load(inputstream);&lt;br /&gt;
 inputstream.close();&lt;br /&gt;
 i = Integer.parseInt(properties.getProperty(&amp;quot;logger.registeredlevel&amp;quot;));&lt;br /&gt;
 if(i &amp;lt; 0 || i &amp;gt; 3)&lt;br /&gt;
 i = 0;&lt;br /&gt;
 }&lt;br /&gt;
 catch(Exception exception) {&lt;br /&gt;
 System.out.println(&amp;quot;Logger: Failed in the getRegisteredLevel method&amp;quot;);&lt;br /&gt;
 exception.printStackTrace();&lt;br /&gt;
 }&lt;br /&gt;
 return i;&lt;br /&gt;
 }&lt;br /&gt;
 public static void initialize() {&lt;br /&gt;
 logger = new Logger();&lt;br /&gt;
 }&lt;br /&gt;
 // singleton - pattern&lt;br /&gt;
 private static Logger logger;&lt;br /&gt;
 public static Logger getLogger() {&lt;br /&gt;
 return logger;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== [http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern Critique of the Singleton Pattern]==&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Critique of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and flexibility and drawbacks like overhead, development confusion and Object lifetime while using the singleton pattern.&lt;br /&gt;
&lt;br /&gt;
==[http://www.ibm.com/developerworks/webservices/library/co-single/index.html Use Singletons Wisely]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
When to use, Moving away from Singletons, Aggregating Singletons&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The programming community discourages using global data and objects. Still, there are times when an application needs a single instance of a given class and a global point of access to that class. The general solution is the design pattern known as singletons. However, singletons are unnecessarily difficult to test and may make strong assumptions about the applications that will use them. In this article the author discusses strategies for avoiding the singleton pattern for that majority of cases where it is not appropriate. He also describes the properties of some classes that are truly singletons.&lt;br /&gt;
&lt;br /&gt;
'''Aggregating Singletons: The Toolbox''':&lt;br /&gt;
Singleton abuse can be avoided by looking at the problem from a different angle. Suppose an application needs only one instance of a class and the application configures that class at startup: Why should the class itself be responsible for being a singleton? It seems quite logical for the application to take on this responsibility, since the application requires this kind of behavior. The application, not the component, should be the singleton. The application then makes an instance of the component available for any application-specific code to use. When an application uses several such components, it can aggregate them into what we have called a toolbox.&lt;br /&gt;
Put simply, the application's toolbox is a singleton that is responsible either for configuring itself or for allowing the application's startup mechanism to configure it. The general pattern of the Toolbox singleton is as shown in the example provided in this article&lt;br /&gt;
The Toolbox is itself a singleton, and it manages the lifetime of the various component instances. Either the application configures it, or it asks the application for configuration information in method initialize. Now the application can decide how many instances of which classes it requires. Changes in those decisions may affect application-specific code, but not reusable, infrastructure-level code. Moreover, testing infrastructure code is much easier, as those classes do not rely on the way in which any application may choose to use them.&lt;br /&gt;
&lt;br /&gt;
== [http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious When Not to Use Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Appropriate Use of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The Gang of Four states that you'll want to use Singleton there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point or when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx&lt;br /&gt;
&lt;br /&gt;
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html&lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/singleton&lt;br /&gt;
&lt;br /&gt;
http://c2.com/cgi/wiki?SingletonPattern&lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/singleton-pattern.html&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/en-us/library/ff650316.aspx&lt;br /&gt;
&lt;br /&gt;
http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html&lt;br /&gt;
&lt;br /&gt;
http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern&lt;br /&gt;
&lt;br /&gt;
http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern&lt;br /&gt;
&lt;br /&gt;
http://www.roseindia.net/designpattern/singleton_pattern.shtml&lt;br /&gt;
&lt;br /&gt;
http://www.ibm.com/developerworks/webservices/library/co-single/index.html&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70834</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70834"/>
		<updated>2012-11-19T22:40:13Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, Directory of Sites=&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:3.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html Simply Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Capabilities of Singleton pattern,Singleton design pattern class diagram, Example, use of protected constructors.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
The Singleton design pattern addresses all of the previous paragraph's concerns. With the Singleton design pattern you can:&lt;br /&gt;
* Ensure that only one instance of a class is created.&lt;br /&gt;
* Provide a global point of access to the object.&lt;br /&gt;
* Allow multiple instances in the future without affecting a singleton class's clients.&lt;br /&gt;
&lt;br /&gt;
As in , [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html#resources Design Patterns], &amp;quot;Ensure a class has a single instance, and provide a global point of access to it&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:4.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Other than the lazy initialization process, a classicSingleton class can also implement a protected constructor so client cannot instantiate ClassicSingleton instances; however, you may be surprised to discover that the following code is perfectly legal:&lt;br /&gt;
&lt;br /&gt;
 public class SingletonInstantiator { &lt;br /&gt;
 public SingletonInstantiator() { &lt;br /&gt;
 ClassicSingleton instance = ClassicSingleton.getInstance();&lt;br /&gt;
 ClassicSingleton anotherInstance =&lt;br /&gt;
 new ClassicSingleton();&lt;br /&gt;
 ... &lt;br /&gt;
  } &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Protected constructors can be called by subclasses and by other classes in the same package. Because ClassicSingleton and SingletonInstantiator are in the same package (the default package), SingletonInstantiator() methods can create ClassicSingleton instances. This dilemma has two solutions: You can make the ClassicSingleton constructor private so that only ClassicSingleton() methods call it; however, that means ClassicSingleton cannot be subclassed. Sometimes, that is a desirable solution; if so, it's a good idea to declare your singleton class final, which makes that intention explicit and allows the compiler to apply performance optimizations. The other solution is to put your singleton class in an explicit package, so classes in other packages (including the default package) cannot instantiate singleton instances.&lt;br /&gt;
&lt;br /&gt;
== [http://javapapers.com/design-patterns/singleton-pattern/ JavaPaper on Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Strategy for Singleton instance creation, Early and lazy instantiation in singleton pattern, Singleton and Serialization&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
There are only two points in the definition of a singleton design pattern,&lt;br /&gt;
* There should be only one instance allowed for a class and&lt;br /&gt;
* We should allow global point of access to that single instance.&lt;br /&gt;
&lt;br /&gt;
The key is not the problem and definition. In singleton pattern, trickier part is implementation and management of that single instance.&lt;br /&gt;
&lt;br /&gt;
We suppress the constructor and don’t allow even a single instance for the class. But we declare an attribute for that same class inside and create instance for that and return it. [http://javapapers.com/design-patterns/abstract-factory-pattern/ Factory design pattern] can be used to create the singleton instance.&lt;br /&gt;
&lt;br /&gt;
You need to be careful with multiple threads. If you don’t synchronize the method which is going to return the instance then, there is a possibility of allowing multiple instances in a multi-threaded scenario. Do the synchronization at block level considering the performance issues. In the below example for singleton pattern, you can see that it is threadsafe.&lt;br /&gt;
&lt;br /&gt;
 package com.javapapers.sample.designpattern;&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static Singleton singleInstance;&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getSingleInstance() {&lt;br /&gt;
 if (singleInstance == null) {&lt;br /&gt;
    synchronized (Singleton.class) {&lt;br /&gt;
      if (singleInstance == null) {&lt;br /&gt;
        singleInstance = new Singleton();&lt;br /&gt;
       }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    return singleInstance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Singleton and Serialization''' : Using [http://javapapers.com/core-java/java-serialization/ serialization], single instance contract of the singleton pattern can be violated. You can serialize and de-serialize and get a new instance of the same singleton class. Using java api, you can implement the below method and override the instance read from the stream. So that you can always ensure that you have single instance.&lt;br /&gt;
&lt;br /&gt;
 ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;&lt;br /&gt;
&lt;br /&gt;
'''Usage of Singleton Pattern in Java API''': &lt;br /&gt;
&lt;br /&gt;
 java.lang.Runtime#getRuntime() &lt;br /&gt;
 java.awt.Desktop#getDesktop()&lt;br /&gt;
&lt;br /&gt;
== [http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects Positive and Negative aspects of Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Introduction, Positive sides of Singleton, Lazy and Static initialization, Negative sides of Singleton, When to use a Singleton class.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
positive sides: The anatomy of a singleton class is very simple to understand. The class typically has a private constructor which will prohibit you to make any instance of the singleton class; instead you will access a static property or static function of the singleton class to get the reference of a preconfigured instance. These properties/methods ensure that there will be only one instance of the singleton class throughout the lifetime of the application.&lt;br /&gt;
&lt;br /&gt;
The one and only instance of a singleton class is created within the singleton class and its reference is consumed by the callers. The creation process of the instance can be done using any of the following methods:&lt;br /&gt;
&lt;br /&gt;
'''Lazy Initialization'''&lt;br /&gt;
If you opt for the lazy instantiation paradigm, then the singleton variable will not get memory until the property or function designated to return the reference is first called. This type of instantiation is very helpful if your singleton class is resource intense.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:5.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In order to make it thread-safe, One way is the use of double-checked locking. In double-checked locking, synchronization is only effective when the singleton variable is null, i.e., only for the first time call to Instance.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:6.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization'''&lt;br /&gt;
In static initialization, memory is allocated to the variable at the time it is declared. The instance creation takes place behind the scenes when any of the member singleton classes is accessed for the first time. The main advantage of this type of implementation is that the CLR automatically takes care of race conditions I explained in lazy instantiation. We don't have to use any special synchronization constructs here.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:7.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Inheriting a singleton class should be prohibited.&lt;br /&gt;
* Singleton takes over static classes on the following shortcomings:&lt;br /&gt;
1. Static classes don’t promote inheritance. If your class has some interface to derive from, static classes makes it impossible.&lt;br /&gt;
2. You cannot specify any creation logic with static methods.&lt;br /&gt;
3. Static methods are procedural code.&lt;br /&gt;
&lt;br /&gt;
'''Negative sides of Singleton''':&lt;br /&gt;
1.They deviate from the Single Responsibility Principle. A singleton class has the responsibility to create an instance of itself along with other business responsibilities. However, this issue can be solved by delegating the creation part to a factory object.&lt;br /&gt;
2. Singleton classes cannot be sub classed.&lt;br /&gt;
3. Singletons can hide dependencies. One of the features of an efficient system architecture is minimizing dependencies between classes. This will in turn help you while conducting unit tests and while isolating any part of the program to a separate assembly.&lt;br /&gt;
&lt;br /&gt;
However, it is commonly accepted that the singleton can yield best results in a situation where various parts of an application concurrently try to access a shared resource. An example of a shared resource would be Logger, Print Spooler, etc. When designing a singleton, consider the following points:&lt;br /&gt;
1. Singleton classes must be memory-leak free. The instance of the singleton class is to be created once and it remains for the lifetime of the application.&lt;br /&gt;
2. A real singleton class is not easily extensible.&lt;br /&gt;
3. Derive the singleton class from an interface. This helps while doing unit testing (using Dependency Injection).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
== [http://c2.com/cgi/wiki?SingletonPattern Singleton explained on c2.com]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Simulation of global variables, Appropriate Use of Singleton, Singleton in threaded environment&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly explains aspects like testing, creational logic,polymorphism involved in singleton pattern.It explains situations when singleton pattern can be used.It goes on to explain the anti-pattern of singletons simulating global variables and appropriate use of singleton in mutithreaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Problem of using Singleton in Multithreaded Environment''' : &lt;br /&gt;
&lt;br /&gt;
 static private synchronized Singleton instance_helper(){&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;quot;_instance&amp;quot; can be null in the logic for multiple threads before instance_helper is called, leading to multiple instances being created&lt;br /&gt;
&lt;br /&gt;
'''Solution for Singleton in Multithreaded Environment''' : &lt;br /&gt;
 &lt;br /&gt;
 static private synchronized Singleton instance_helper()&lt;br /&gt;
 {&lt;br /&gt;
 if(flag)&lt;br /&gt;
 {&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 flag = false;&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
== [http://www.oodesign.com/singleton-pattern.html Singleton Applications]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Motivation, Intent, Implementation, Applicability and Examples&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link gives some extra information about applicability of Singleton in logger classes,configuration classes, accessing resources in shared environment,factories implemented as Singleton,Implementations and problems involved&lt;br /&gt;
&lt;br /&gt;
'''Serialization''' :&lt;br /&gt;
&lt;br /&gt;
If the Singleton class implements the java.io.Serializable interface, when a singleton is serialized and then deserialized more than once, there will be multiple instances of Singleton created. In order to avoid this the readResolve method should be implemented. &lt;br /&gt;
&lt;br /&gt;
 public class Singleton implements Serializable {&lt;br /&gt;
 ...&lt;br /&gt;
 // This method is called immediately after an object of this class is deserialized.&lt;br /&gt;
 // This method returns the singleton instance.&lt;br /&gt;
 protected Object readResolve() {&lt;br /&gt;
 return getInstance();&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[http://msdn.microsoft.com/en-us/library/ff650316.aspx Singleton Implementation in C#]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Implementation in C#&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link explains how to implement a singleton in C# both in static and threaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization''':&lt;br /&gt;
&lt;br /&gt;
One of the reasons Design Patterns [Gamma95] avoided static initialization is because the C++ specification left some ambiguity around the initialization order of static variables. Fortunately, the .NET Framework resolves this ambiguity through its handling of variable initialization:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 public sealed class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static readonly Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton(){}&lt;br /&gt;
 public static Singleton Instance&lt;br /&gt;
 {&lt;br /&gt;
 get &lt;br /&gt;
 { &lt;br /&gt;
 return instance; &lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing Singleton in C# results in the following benefits and liabilities:&lt;br /&gt;
&lt;br /&gt;
'''Benefits''':&lt;br /&gt;
*The static initialization approach is possible because the .NET Framework explicitly defines how and when static variable initialization occurs.&lt;br /&gt;
*The Double-Check Locking idiom described earlier in &amp;quot;Multithreaded Singleton&amp;quot; is implemented correctly in the common language runtime.&lt;br /&gt;
&lt;br /&gt;
'''Liabilities''':&lt;br /&gt;
If your multithreaded application requires explicit initialization, you have to take precautions to avoid threading issues.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html Refactor Singleton Out Of Your Code]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Solution to refactor singleton&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Gang of Four mentions Singleton as an anti-pattern and not as a pattern. This Link provides a solution to refactor Singleton out of the code&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
'''Steps to refactor Singleton:'''&lt;br /&gt;
* Create simple interface for Registry with two simple methods - getter and setter for instance of class which is currently implemented as singleton.&lt;br /&gt;
 public interface ISingletonRegistry {&lt;br /&gt;
 SingletonClass getSingletonClass();&lt;br /&gt;
 void setSingletonClass(SingletonClass singleton);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Make SingletonClass's constructor public&lt;br /&gt;
&lt;br /&gt;
* Then implement the interface as a simplest Registry design pattern implementation - SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
 public class SingletonRegistry implements ISingletonRegistry {&lt;br /&gt;
 private static final SingletonRegistry INSTANCE = new SingletonRegistry();&lt;br /&gt;
 private SingletonClass singleton;&lt;br /&gt;
 public static ISingletonRegistry getInstance() {&lt;br /&gt;
 return INSTANCE;&lt;br /&gt;
 }&lt;br /&gt;
 private SingletonRegistry() {&lt;br /&gt;
 //this is the reason why the constructor should be public&lt;br /&gt;
 singleton = new SingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
 public SingletonClass getSingletonClass() {&lt;br /&gt;
 return singleton;&lt;br /&gt;
 }&lt;br /&gt;
 public void setSingletonClass(SingletonClass singleton) {&lt;br /&gt;
 this.singleton = singleton;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Change getInstance method of SingletonClass to get instance from SingletonRegistry.&lt;br /&gt;
 public static SingletonClass getInstance() {&lt;br /&gt;
 return SingletonRegistry.getInstance().getSingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The method getInstance from SingletonClass disappears and all it's client classes uses SingletonRegistry to access SingletonClass.&lt;br /&gt;
 public class Client {&lt;br /&gt;
 public void clientMethod() {&lt;br /&gt;
 SingletonRegistry.getInstance() .getSingletonClass().voidMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 Object object = SingletonRegistry.getInstance() .getSingletonClass().objectMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Delete INSTANCE constant from SingletonClass class.&lt;br /&gt;
&lt;br /&gt;
* You can Extract Interface (Alt+Shift+T, E) from SingletonClass. Write just new interface name, select all methods from SingletonClass which you can extract into new interface and press OK. All references to SingletonClass will be refactored to references to your newly created interface.&lt;br /&gt;
&lt;br /&gt;
And that is all. Now you have SingletonClass with totally same functionality but you are able to mock it, extend or replace by different implementation setting up your instance of SingletonClass to SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
== [http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern/ Refactoring:Extracting the Singleton Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Extracting the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Here, the author demonstrates the refactoring of Singleton Pattern by means of an example of a Device Manger class. So the main class that will be changing is the DeviceManager. This class manages a collection of Devices (or a dictionary, to be more precise) and allows to set which is the active device and to get a device by id. Note that this last feature could be handled by the Devices collection, but we are taking advantage of the dictionary to make that look-up more efficient.&lt;br /&gt;
&lt;br /&gt;
== [http://www.roseindia.net/designpattern/singleton_pattern.shtml Singleton Pattern Usage and Benefits]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Usage, Benefits, Example&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and usage in multithreaded environment.Singleton patterns are often used as global variables because the global variables permit allocation and initialization whenever required. They don't permit to pollute the global namespace with unnecessary variables.&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
 package singleton;&lt;br /&gt;
 public class Logger {&lt;br /&gt;
 private String fileName;&lt;br /&gt;
 private Properties properties;&lt;br /&gt;
 private Priority priority;&lt;br /&gt;
 private Logger() {&lt;br /&gt;
 logger = this;&lt;br /&gt;
 }&lt;br /&gt;
 public int getRegisteredLevel() {&lt;br /&gt;
 int i = 0;&lt;br /&gt;
 try {&lt;br /&gt;
 InputStream inputstream = getClass().getResourceAsStream(&amp;quot;Logger.properties&amp;quot;);&lt;br /&gt;
 properties.load(inputstream);&lt;br /&gt;
 inputstream.close();&lt;br /&gt;
 i = Integer.parseInt(properties.getProperty(&amp;quot;logger.registeredlevel&amp;quot;));&lt;br /&gt;
 if(i &amp;lt; 0 || i &amp;gt; 3)&lt;br /&gt;
 i = 0;&lt;br /&gt;
 }&lt;br /&gt;
 catch(Exception exception) {&lt;br /&gt;
 System.out.println(&amp;quot;Logger: Failed in the getRegisteredLevel method&amp;quot;);&lt;br /&gt;
 exception.printStackTrace();&lt;br /&gt;
 }&lt;br /&gt;
 return i;&lt;br /&gt;
 }&lt;br /&gt;
 public static void initialize() {&lt;br /&gt;
 logger = new Logger();&lt;br /&gt;
 }&lt;br /&gt;
 // singleton - pattern&lt;br /&gt;
 private static Logger logger;&lt;br /&gt;
 public static Logger getLogger() {&lt;br /&gt;
 return logger;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== [http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern Critique of the Singleton Pattern]==&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Critique of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and flexibility and drawbacks like overhead, development confusion and Object lifetime while using the singleton pattern.&lt;br /&gt;
&lt;br /&gt;
==[http://www.ibm.com/developerworks/webservices/library/co-single/index.html Use Singletons Wisely]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
When to use, Moving away from Singletons, Aggregating Singletons&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The programming community discourages using global data and objects. Still, there are times when an application needs a single instance of a given class and a global point of access to that class. The general solution is the design pattern known as singletons. However, singletons are unnecessarily difficult to test and may make strong assumptions about the applications that will use them. In this article the author discusses strategies for avoiding the singleton pattern for that majority of cases where it is not appropriate. He also describes the properties of some classes that are truly singletons.&lt;br /&gt;
&lt;br /&gt;
'''Aggregating Singletons: The Toolbox''':&lt;br /&gt;
Singleton abuse can be avoided by looking at the problem from a different angle. Suppose an application needs only one instance of a class and the application configures that class at startup: Why should the class itself be responsible for being a singleton? It seems quite logical for the application to take on this responsibility, since the application requires this kind of behavior. The application, not the component, should be the singleton. The application then makes an instance of the component available for any application-specific code to use. When an application uses several such components, it can aggregate them into what we have called a toolbox.&lt;br /&gt;
Put simply, the application's toolbox is a singleton that is responsible either for configuring itself or for allowing the application's startup mechanism to configure it. The general pattern of the Toolbox singleton is as shown in the example provided in this article&lt;br /&gt;
The Toolbox is itself a singleton, and it manages the lifetime of the various component instances. Either the application configures it, or it asks the application for configuration information in method initialize. Now the application can decide how many instances of which classes it requires. Changes in those decisions may affect application-specific code, but not reusable, infrastructure-level code. Moreover, testing infrastructure code is much easier, as those classes do not rely on the way in which any application may choose to use them.&lt;br /&gt;
&lt;br /&gt;
== [http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious When Not to Use Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Appropriate Use of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The Gang of Four states that you'll want to use Singleton there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point or when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx&lt;br /&gt;
&lt;br /&gt;
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html&lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/singleton&lt;br /&gt;
&lt;br /&gt;
http://c2.com/cgi/wiki?SingletonPattern&lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/singleton-pattern.html&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/en-us/library/ff650316.aspx&lt;br /&gt;
&lt;br /&gt;
http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html&lt;br /&gt;
&lt;br /&gt;
http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern&lt;br /&gt;
&lt;br /&gt;
http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern&lt;br /&gt;
&lt;br /&gt;
http://www.roseindia.net/designpattern/singleton_pattern.shtml&lt;br /&gt;
&lt;br /&gt;
http://www.ibm.com/developerworks/webservices/library/co-single/index.html&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:7.gif&amp;diff=70829</id>
		<title>File:7.gif</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:7.gif&amp;diff=70829"/>
		<updated>2012-11-19T22:35:48Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:6.gif&amp;diff=70828</id>
		<title>File:6.gif</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:6.gif&amp;diff=70828"/>
		<updated>2012-11-19T22:35:41Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:5.gif&amp;diff=70827</id>
		<title>File:5.gif</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:5.gif&amp;diff=70827"/>
		<updated>2012-11-19T22:35:28Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70820</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70820"/>
		<updated>2012-11-19T22:21:54Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, Directory of Sites=&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:3.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html Simply Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Capabilities of Singleton pattern,Singleton design pattern class diagram, Example, use of protected constructors.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
The Singleton design pattern addresses all of the previous paragraph's concerns. With the Singleton design pattern you can:&lt;br /&gt;
* Ensure that only one instance of a class is created.&lt;br /&gt;
* Provide a global point of access to the object.&lt;br /&gt;
* Allow multiple instances in the future without affecting a singleton class's clients.&lt;br /&gt;
&lt;br /&gt;
As in , [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html#resources Design Patterns], &amp;quot;Ensure a class has a single instance, and provide a global point of access to it&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:4.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Other than the lazy initialization process, a classicSingleton class can also implement a protected constructor so client cannot instantiate ClassicSingleton instances; however, you may be surprised to discover that the following code is perfectly legal:&lt;br /&gt;
&lt;br /&gt;
 public class SingletonInstantiator { &lt;br /&gt;
 public SingletonInstantiator() { &lt;br /&gt;
 ClassicSingleton instance = ClassicSingleton.getInstance();&lt;br /&gt;
 ClassicSingleton anotherInstance =&lt;br /&gt;
 new ClassicSingleton();&lt;br /&gt;
 ... &lt;br /&gt;
  } &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Protected constructors can be called by subclasses and by other classes in the same package. Because ClassicSingleton and SingletonInstantiator are in the same package (the default package), SingletonInstantiator() methods can create ClassicSingleton instances. This dilemma has two solutions: You can make the ClassicSingleton constructor private so that only ClassicSingleton() methods call it; however, that means ClassicSingleton cannot be subclassed. Sometimes, that is a desirable solution; if so, it's a good idea to declare your singleton class final, which makes that intention explicit and allows the compiler to apply performance optimizations. The other solution is to put your singleton class in an explicit package, so classes in other packages (including the default package) cannot instantiate singleton instances.&lt;br /&gt;
&lt;br /&gt;
== [http://javapapers.com/design-patterns/singleton-pattern/ JavaPaper on Singleton]==&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Strategy for Singleton instance creation, Early and lazy instantiation in singleton pattern, Singleton and Serialization&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
There are only two points in the definition of a singleton design pattern,&lt;br /&gt;
* There should be only one instance allowed for a class and&lt;br /&gt;
* We should allow global point of access to that single instance.&lt;br /&gt;
&lt;br /&gt;
The key is not the problem and definition. In singleton pattern, trickier part is implementation and management of that single instance.&lt;br /&gt;
&lt;br /&gt;
We suppress the constructor and don’t allow even a single instance for the class. But we declare an attribute for that same class inside and create instance for that and return it. [http://javapapers.com/design-patterns/abstract-factory-pattern/ Factory design pattern] can be used to create the singleton instance.&lt;br /&gt;
&lt;br /&gt;
You need to be careful with multiple threads. If you don’t synchronize the method which is going to return the instance then, there is a possibility of allowing multiple instances in a multi-threaded scenario. Do the synchronization at block level considering the performance issues. In the below example for singleton pattern, you can see that it is threadsafe.&lt;br /&gt;
&lt;br /&gt;
 package com.javapapers.sample.designpattern;&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static Singleton singleInstance;&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getSingleInstance() {&lt;br /&gt;
 if (singleInstance == null) {&lt;br /&gt;
    synchronized (Singleton.class) {&lt;br /&gt;
      if (singleInstance == null) {&lt;br /&gt;
        singleInstance = new Singleton();&lt;br /&gt;
       }&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    return singleInstance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
'''Singleton and Serialization''' : Using [http://javapapers.com/core-java/java-serialization/ serialization], single instance contract of the singleton pattern can be violated. You can serialize and de-serialize and get a new instance of the same singleton class. Using java api, you can implement the below method and override the instance read from the stream. So that you can always ensure that you have single instance.&lt;br /&gt;
&lt;br /&gt;
 ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;&lt;br /&gt;
&lt;br /&gt;
'''Usage of Singleton Pattern in Java API''': &lt;br /&gt;
&lt;br /&gt;
 java.lang.Runtime#getRuntime() &lt;br /&gt;
 java.awt.Desktop#getDesktop()&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
== [http://c2.com/cgi/wiki?SingletonPattern Singleton explained on c2.com]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Simulation of global variables, Appropriate Use of Singleton, Singleton in threaded environment&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly explains aspects like testing, creational logic,polymorphism involved in singleton pattern.It explains situations when singleton pattern can be used.It goes on to explain the anti-pattern of singletons simulating global variables and appropriate use of singleton in mutithreaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Problem of using Singleton in Multithreaded Environment''' : &lt;br /&gt;
&lt;br /&gt;
 static private synchronized Singleton instance_helper(){&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;quot;_instance&amp;quot; can be null in the logic for multiple threads before instance_helper is called, leading to multiple instances being created&lt;br /&gt;
&lt;br /&gt;
'''Solution for Singleton in Multithreaded Environment''' : &lt;br /&gt;
 &lt;br /&gt;
 static private synchronized Singleton instance_helper()&lt;br /&gt;
 {&lt;br /&gt;
 if(flag)&lt;br /&gt;
 {&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 flag = false;&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
== [http://www.oodesign.com/singleton-pattern.html Singleton Applications]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Motivation, Intent, Implementation, Applicability and Examples&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link gives some extra information about applicability of Singleton in logger classes,configuration classes, accessing resources in shared environment,factories implemented as Singleton,Implementations and problems involved&lt;br /&gt;
&lt;br /&gt;
'''Serialization''' :&lt;br /&gt;
&lt;br /&gt;
If the Singleton class implements the java.io.Serializable interface, when a singleton is serialized and then deserialized more than once, there will be multiple instances of Singleton created. In order to avoid this the readResolve method should be implemented. &lt;br /&gt;
&lt;br /&gt;
 public class Singleton implements Serializable {&lt;br /&gt;
 ...&lt;br /&gt;
 // This method is called immediately after an object of this class is deserialized.&lt;br /&gt;
 // This method returns the singleton instance.&lt;br /&gt;
 protected Object readResolve() {&lt;br /&gt;
 return getInstance();&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[http://msdn.microsoft.com/en-us/library/ff650316.aspx Singleton Implementation in C#]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Implementation in C#&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link explains how to implement a singleton in C# both in static and threaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization''':&lt;br /&gt;
&lt;br /&gt;
One of the reasons Design Patterns [Gamma95] avoided static initialization is because the C++ specification left some ambiguity around the initialization order of static variables. Fortunately, the .NET Framework resolves this ambiguity through its handling of variable initialization:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 public sealed class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static readonly Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton(){}&lt;br /&gt;
 public static Singleton Instance&lt;br /&gt;
 {&lt;br /&gt;
 get &lt;br /&gt;
 { &lt;br /&gt;
 return instance; &lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing Singleton in C# results in the following benefits and liabilities:&lt;br /&gt;
&lt;br /&gt;
'''Benefits''':&lt;br /&gt;
*The static initialization approach is possible because the .NET Framework explicitly defines how and when static variable initialization occurs.&lt;br /&gt;
*The Double-Check Locking idiom described earlier in &amp;quot;Multithreaded Singleton&amp;quot; is implemented correctly in the common language runtime.&lt;br /&gt;
&lt;br /&gt;
'''Liabilities''':&lt;br /&gt;
If your multithreaded application requires explicit initialization, you have to take precautions to avoid threading issues.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html Refactor Singleton Out Of Your Code]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Solution to refactor singleton&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Gang of Four mentions Singleton as an anti-pattern and not as a pattern. This Link provides a solution to refactor Singleton out of the code&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
'''Steps to refactor Singleton:'''&lt;br /&gt;
* Create simple interface for Registry with two simple methods - getter and setter for instance of class which is currently implemented as singleton.&lt;br /&gt;
 public interface ISingletonRegistry {&lt;br /&gt;
 SingletonClass getSingletonClass();&lt;br /&gt;
 void setSingletonClass(SingletonClass singleton);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Make SingletonClass's constructor public&lt;br /&gt;
&lt;br /&gt;
* Then implement the interface as a simplest Registry design pattern implementation - SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
 public class SingletonRegistry implements ISingletonRegistry {&lt;br /&gt;
 private static final SingletonRegistry INSTANCE = new SingletonRegistry();&lt;br /&gt;
 private SingletonClass singleton;&lt;br /&gt;
 public static ISingletonRegistry getInstance() {&lt;br /&gt;
 return INSTANCE;&lt;br /&gt;
 }&lt;br /&gt;
 private SingletonRegistry() {&lt;br /&gt;
 //this is the reason why the constructor should be public&lt;br /&gt;
 singleton = new SingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
 public SingletonClass getSingletonClass() {&lt;br /&gt;
 return singleton;&lt;br /&gt;
 }&lt;br /&gt;
 public void setSingletonClass(SingletonClass singleton) {&lt;br /&gt;
 this.singleton = singleton;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Change getInstance method of SingletonClass to get instance from SingletonRegistry.&lt;br /&gt;
 public static SingletonClass getInstance() {&lt;br /&gt;
 return SingletonRegistry.getInstance().getSingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The method getInstance from SingletonClass disappears and all it's client classes uses SingletonRegistry to access SingletonClass.&lt;br /&gt;
 public class Client {&lt;br /&gt;
 public void clientMethod() {&lt;br /&gt;
 SingletonRegistry.getInstance() .getSingletonClass().voidMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 Object object = SingletonRegistry.getInstance() .getSingletonClass().objectMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Delete INSTANCE constant from SingletonClass class.&lt;br /&gt;
&lt;br /&gt;
* You can Extract Interface (Alt+Shift+T, E) from SingletonClass. Write just new interface name, select all methods from SingletonClass which you can extract into new interface and press OK. All references to SingletonClass will be refactored to references to your newly created interface.&lt;br /&gt;
&lt;br /&gt;
And that is all. Now you have SingletonClass with totally same functionality but you are able to mock it, extend or replace by different implementation setting up your instance of SingletonClass to SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
== [http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern/ Refactoring:Extracting the Singleton Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Extracting the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Here, the author demonstrates the refactoring of Singleton Pattern by means of an example of a Device Manger class. So the main class that will be changing is the DeviceManager. This class manages a collection of Devices (or a dictionary, to be more precise) and allows to set which is the active device and to get a device by id. Note that this last feature could be handled by the Devices collection, but we are taking advantage of the dictionary to make that look-up more efficient.&lt;br /&gt;
&lt;br /&gt;
== [http://www.roseindia.net/designpattern/singleton_pattern.shtml Singleton Pattern Usage and Benefits]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Usage, Benefits, Example&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and usage in multithreaded environment.Singleton patterns are often used as global variables because the global variables permit allocation and initialization whenever required. They don't permit to pollute the global namespace with unnecessary variables.&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
 package singleton;&lt;br /&gt;
 public class Logger {&lt;br /&gt;
 private String fileName;&lt;br /&gt;
 private Properties properties;&lt;br /&gt;
 private Priority priority;&lt;br /&gt;
 private Logger() {&lt;br /&gt;
 logger = this;&lt;br /&gt;
 }&lt;br /&gt;
 public int getRegisteredLevel() {&lt;br /&gt;
 int i = 0;&lt;br /&gt;
 try {&lt;br /&gt;
 InputStream inputstream = getClass().getResourceAsStream(&amp;quot;Logger.properties&amp;quot;);&lt;br /&gt;
 properties.load(inputstream);&lt;br /&gt;
 inputstream.close();&lt;br /&gt;
 i = Integer.parseInt(properties.getProperty(&amp;quot;logger.registeredlevel&amp;quot;));&lt;br /&gt;
 if(i &amp;lt; 0 || i &amp;gt; 3)&lt;br /&gt;
 i = 0;&lt;br /&gt;
 }&lt;br /&gt;
 catch(Exception exception) {&lt;br /&gt;
 System.out.println(&amp;quot;Logger: Failed in the getRegisteredLevel method&amp;quot;);&lt;br /&gt;
 exception.printStackTrace();&lt;br /&gt;
 }&lt;br /&gt;
 return i;&lt;br /&gt;
 }&lt;br /&gt;
 public static void initialize() {&lt;br /&gt;
 logger = new Logger();&lt;br /&gt;
 }&lt;br /&gt;
 // singleton - pattern&lt;br /&gt;
 private static Logger logger;&lt;br /&gt;
 public static Logger getLogger() {&lt;br /&gt;
 return logger;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== [http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern Critique of the Singleton Pattern]==&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Critique of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and flexibility and drawbacks like overhead, development confusion and Object lifetime while using the singleton pattern.&lt;br /&gt;
&lt;br /&gt;
==[http://www.ibm.com/developerworks/webservices/library/co-single/index.html Use Singletons Wisely]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
When to use, Moving away from Singletons, Aggregating Singletons&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The programming community discourages using global data and objects. Still, there are times when an application needs a single instance of a given class and a global point of access to that class. The general solution is the design pattern known as singletons. However, singletons are unnecessarily difficult to test and may make strong assumptions about the applications that will use them. In this article the author discusses strategies for avoiding the singleton pattern for that majority of cases where it is not appropriate. He also describes the properties of some classes that are truly singletons.&lt;br /&gt;
&lt;br /&gt;
'''Aggregating Singletons: The Toolbox''':&lt;br /&gt;
Singleton abuse can be avoided by looking at the problem from a different angle. Suppose an application needs only one instance of a class and the application configures that class at startup: Why should the class itself be responsible for being a singleton? It seems quite logical for the application to take on this responsibility, since the application requires this kind of behavior. The application, not the component, should be the singleton. The application then makes an instance of the component available for any application-specific code to use. When an application uses several such components, it can aggregate them into what we have called a toolbox.&lt;br /&gt;
Put simply, the application's toolbox is a singleton that is responsible either for configuring itself or for allowing the application's startup mechanism to configure it. The general pattern of the Toolbox singleton is as shown in the example provided in this article&lt;br /&gt;
The Toolbox is itself a singleton, and it manages the lifetime of the various component instances. Either the application configures it, or it asks the application for configuration information in method initialize. Now the application can decide how many instances of which classes it requires. Changes in those decisions may affect application-specific code, but not reusable, infrastructure-level code. Moreover, testing infrastructure code is much easier, as those classes do not rely on the way in which any application may choose to use them.&lt;br /&gt;
&lt;br /&gt;
== [http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious When Not to Use Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Appropriate Use of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The Gang of Four states that you'll want to use Singleton there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point or when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx&lt;br /&gt;
&lt;br /&gt;
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html&lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/singleton&lt;br /&gt;
&lt;br /&gt;
http://c2.com/cgi/wiki?SingletonPattern&lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/singleton-pattern.html&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/en-us/library/ff650316.aspx&lt;br /&gt;
&lt;br /&gt;
http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html&lt;br /&gt;
&lt;br /&gt;
http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern&lt;br /&gt;
&lt;br /&gt;
http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern&lt;br /&gt;
&lt;br /&gt;
http://www.roseindia.net/designpattern/singleton_pattern.shtml&lt;br /&gt;
&lt;br /&gt;
http://www.ibm.com/developerworks/webservices/library/co-single/index.html&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70815</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70815"/>
		<updated>2012-11-19T22:13:10Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Simply Singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, Directory of Sites=&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:3.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html Simply Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Capabilities of Singleton pattern,Singleton design pattern class diagram, Example, use of protected constructors.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
The Singleton design pattern addresses all of the previous paragraph's concerns. With the Singleton design pattern you can:&lt;br /&gt;
* Ensure that only one instance of a class is created.&lt;br /&gt;
* Provide a global point of access to the object.&lt;br /&gt;
* Allow multiple instances in the future without affecting a singleton class's clients.&lt;br /&gt;
&lt;br /&gt;
As in , [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html#resources Design Patterns], &amp;quot;Ensure a class has a single instance, and provide a global point of access to it&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:4.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Other than the lazy initialization process, a classicSingleton class can also implement a protected constructor so client cannot instantiate ClassicSingleton instances; however, you may be surprised to discover that the following code is perfectly legal:&lt;br /&gt;
&lt;br /&gt;
 public class SingletonInstantiator { &lt;br /&gt;
 public SingletonInstantiator() { &lt;br /&gt;
 ClassicSingleton instance = ClassicSingleton.getInstance();&lt;br /&gt;
 ClassicSingleton anotherInstance =&lt;br /&gt;
 new ClassicSingleton();&lt;br /&gt;
 ... &lt;br /&gt;
  } &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Protected constructors can be called by subclasses and by other classes in the same package. Because ClassicSingleton and SingletonInstantiator are in the same package (the default package), SingletonInstantiator() methods can create ClassicSingleton instances. This dilemma has two solutions: You can make the ClassicSingleton constructor private so that only ClassicSingleton() methods call it; however, that means ClassicSingleton cannot be subclassed. Sometimes, that is a desirable solution; if so, it's a good idea to declare your singleton class final, which makes that intention explicit and allows the compiler to apply performance optimizations. The other solution is to put your singleton class in an explicit package, so classes in other packages (including the default package) cannot instantiate singleton instances.&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
== [http://c2.com/cgi/wiki?SingletonPattern Singleton explained on c2.com]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Simulation of global variables, Appropriate Use of Singleton, Singleton in threaded environment&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly explains aspects like testing, creational logic,polymorphism involved in singleton pattern.It explains situations when singleton pattern can be used.It goes on to explain the anti-pattern of singletons simulating global variables and appropriate use of singleton in mutithreaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Problem of using Singleton in Multithreaded Environment''' : &lt;br /&gt;
&lt;br /&gt;
 static private synchronized Singleton instance_helper(){&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;quot;_instance&amp;quot; can be null in the logic for multiple threads before instance_helper is called, leading to multiple instances being created&lt;br /&gt;
&lt;br /&gt;
'''Solution for Singleton in Multithreaded Environment''' : &lt;br /&gt;
 &lt;br /&gt;
 static private synchronized Singleton instance_helper()&lt;br /&gt;
 {&lt;br /&gt;
 if(flag)&lt;br /&gt;
 {&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 flag = false;&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
== [http://www.oodesign.com/singleton-pattern.html Singleton Applications]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Motivation, Intent, Implementation, Applicability and Examples&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link gives some extra information about applicability of Singleton in logger classes,configuration classes, accessing resources in shared environment,factories implemented as Singleton,Implementations and problems involved&lt;br /&gt;
&lt;br /&gt;
'''Serialization''' :&lt;br /&gt;
&lt;br /&gt;
If the Singleton class implements the java.io.Serializable interface, when a singleton is serialized and then deserialized more than once, there will be multiple instances of Singleton created. In order to avoid this the readResolve method should be implemented. &lt;br /&gt;
&lt;br /&gt;
 public class Singleton implements Serializable {&lt;br /&gt;
 ...&lt;br /&gt;
 // This method is called immediately after an object of this class is deserialized.&lt;br /&gt;
 // This method returns the singleton instance.&lt;br /&gt;
 protected Object readResolve() {&lt;br /&gt;
 return getInstance();&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[http://msdn.microsoft.com/en-us/library/ff650316.aspx Singleton Implementation in C#]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Implementation in C#&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link explains how to implement a singleton in C# both in static and threaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization''':&lt;br /&gt;
&lt;br /&gt;
One of the reasons Design Patterns [Gamma95] avoided static initialization is because the C++ specification left some ambiguity around the initialization order of static variables. Fortunately, the .NET Framework resolves this ambiguity through its handling of variable initialization:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 public sealed class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static readonly Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton(){}&lt;br /&gt;
 public static Singleton Instance&lt;br /&gt;
 {&lt;br /&gt;
 get &lt;br /&gt;
 { &lt;br /&gt;
 return instance; &lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing Singleton in C# results in the following benefits and liabilities:&lt;br /&gt;
&lt;br /&gt;
'''Benefits''':&lt;br /&gt;
*The static initialization approach is possible because the .NET Framework explicitly defines how and when static variable initialization occurs.&lt;br /&gt;
*The Double-Check Locking idiom described earlier in &amp;quot;Multithreaded Singleton&amp;quot; is implemented correctly in the common language runtime.&lt;br /&gt;
&lt;br /&gt;
'''Liabilities''':&lt;br /&gt;
If your multithreaded application requires explicit initialization, you have to take precautions to avoid threading issues.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html Refactor Singleton Out Of Your Code]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Solution to refactor singleton&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Gang of Four mentions Singleton as an anti-pattern and not as a pattern. This Link provides a solution to refactor Singleton out of the code&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
'''Steps to refactor Singleton:'''&lt;br /&gt;
* Create simple interface for Registry with two simple methods - getter and setter for instance of class which is currently implemented as singleton.&lt;br /&gt;
 public interface ISingletonRegistry {&lt;br /&gt;
 SingletonClass getSingletonClass();&lt;br /&gt;
 void setSingletonClass(SingletonClass singleton);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Make SingletonClass's constructor public&lt;br /&gt;
&lt;br /&gt;
* Then implement the interface as a simplest Registry design pattern implementation - SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
 public class SingletonRegistry implements ISingletonRegistry {&lt;br /&gt;
 private static final SingletonRegistry INSTANCE = new SingletonRegistry();&lt;br /&gt;
 private SingletonClass singleton;&lt;br /&gt;
 public static ISingletonRegistry getInstance() {&lt;br /&gt;
 return INSTANCE;&lt;br /&gt;
 }&lt;br /&gt;
 private SingletonRegistry() {&lt;br /&gt;
 //this is the reason why the constructor should be public&lt;br /&gt;
 singleton = new SingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
 public SingletonClass getSingletonClass() {&lt;br /&gt;
 return singleton;&lt;br /&gt;
 }&lt;br /&gt;
 public void setSingletonClass(SingletonClass singleton) {&lt;br /&gt;
 this.singleton = singleton;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Change getInstance method of SingletonClass to get instance from SingletonRegistry.&lt;br /&gt;
 public static SingletonClass getInstance() {&lt;br /&gt;
 return SingletonRegistry.getInstance().getSingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The method getInstance from SingletonClass disappears and all it's client classes uses SingletonRegistry to access SingletonClass.&lt;br /&gt;
 public class Client {&lt;br /&gt;
 public void clientMethod() {&lt;br /&gt;
 SingletonRegistry.getInstance() .getSingletonClass().voidMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 Object object = SingletonRegistry.getInstance() .getSingletonClass().objectMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Delete INSTANCE constant from SingletonClass class.&lt;br /&gt;
&lt;br /&gt;
* You can Extract Interface (Alt+Shift+T, E) from SingletonClass. Write just new interface name, select all methods from SingletonClass which you can extract into new interface and press OK. All references to SingletonClass will be refactored to references to your newly created interface.&lt;br /&gt;
&lt;br /&gt;
And that is all. Now you have SingletonClass with totally same functionality but you are able to mock it, extend or replace by different implementation setting up your instance of SingletonClass to SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
== [http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern/ Refactoring:Extracting the Singleton Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Extracting the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Here, the author demonstrates the refactoring of Singleton Pattern by means of an example of a Device Manger class. So the main class that will be changing is the DeviceManager. This class manages a collection of Devices (or a dictionary, to be more precise) and allows to set which is the active device and to get a device by id. Note that this last feature could be handled by the Devices collection, but we are taking advantage of the dictionary to make that look-up more efficient.&lt;br /&gt;
&lt;br /&gt;
== [http://www.roseindia.net/designpattern/singleton_pattern.shtml Singleton Pattern Usage and Benefits]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Usage, Benefits, Example&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and usage in multithreaded environment.Singleton patterns are often used as global variables because the global variables permit allocation and initialization whenever required. They don't permit to pollute the global namespace with unnecessary variables.&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
 package singleton;&lt;br /&gt;
 public class Logger {&lt;br /&gt;
 private String fileName;&lt;br /&gt;
 private Properties properties;&lt;br /&gt;
 private Priority priority;&lt;br /&gt;
 private Logger() {&lt;br /&gt;
 logger = this;&lt;br /&gt;
 }&lt;br /&gt;
 public int getRegisteredLevel() {&lt;br /&gt;
 int i = 0;&lt;br /&gt;
 try {&lt;br /&gt;
 InputStream inputstream = getClass().getResourceAsStream(&amp;quot;Logger.properties&amp;quot;);&lt;br /&gt;
 properties.load(inputstream);&lt;br /&gt;
 inputstream.close();&lt;br /&gt;
 i = Integer.parseInt(properties.getProperty(&amp;quot;logger.registeredlevel&amp;quot;));&lt;br /&gt;
 if(i &amp;lt; 0 || i &amp;gt; 3)&lt;br /&gt;
 i = 0;&lt;br /&gt;
 }&lt;br /&gt;
 catch(Exception exception) {&lt;br /&gt;
 System.out.println(&amp;quot;Logger: Failed in the getRegisteredLevel method&amp;quot;);&lt;br /&gt;
 exception.printStackTrace();&lt;br /&gt;
 }&lt;br /&gt;
 return i;&lt;br /&gt;
 }&lt;br /&gt;
 public static void initialize() {&lt;br /&gt;
 logger = new Logger();&lt;br /&gt;
 }&lt;br /&gt;
 // singleton - pattern&lt;br /&gt;
 private static Logger logger;&lt;br /&gt;
 public static Logger getLogger() {&lt;br /&gt;
 return logger;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== [http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern Critique of the Singleton Pattern]==&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Critique of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and flexibility and drawbacks like overhead, development confusion and Object lifetime while using the singleton pattern.&lt;br /&gt;
&lt;br /&gt;
==[http://www.ibm.com/developerworks/webservices/library/co-single/index.html Use Singletons Wisely]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
When to use, Moving away from Singletons, Aggregating Singletons&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The programming community discourages using global data and objects. Still, there are times when an application needs a single instance of a given class and a global point of access to that class. The general solution is the design pattern known as singletons. However, singletons are unnecessarily difficult to test and may make strong assumptions about the applications that will use them. In this article the author discusses strategies for avoiding the singleton pattern for that majority of cases where it is not appropriate. He also describes the properties of some classes that are truly singletons.&lt;br /&gt;
&lt;br /&gt;
'''Aggregating Singletons: The Toolbox''':&lt;br /&gt;
Singleton abuse can be avoided by looking at the problem from a different angle. Suppose an application needs only one instance of a class and the application configures that class at startup: Why should the class itself be responsible for being a singleton? It seems quite logical for the application to take on this responsibility, since the application requires this kind of behavior. The application, not the component, should be the singleton. The application then makes an instance of the component available for any application-specific code to use. When an application uses several such components, it can aggregate them into what we have called a toolbox.&lt;br /&gt;
Put simply, the application's toolbox is a singleton that is responsible either for configuring itself or for allowing the application's startup mechanism to configure it. The general pattern of the Toolbox singleton is as shown in the example provided in this article&lt;br /&gt;
The Toolbox is itself a singleton, and it manages the lifetime of the various component instances. Either the application configures it, or it asks the application for configuration information in method initialize. Now the application can decide how many instances of which classes it requires. Changes in those decisions may affect application-specific code, but not reusable, infrastructure-level code. Moreover, testing infrastructure code is much easier, as those classes do not rely on the way in which any application may choose to use them.&lt;br /&gt;
&lt;br /&gt;
== [http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious When Not to Use Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Appropriate Use of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The Gang of Four states that you'll want to use Singleton there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point or when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx&lt;br /&gt;
&lt;br /&gt;
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html&lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/singleton&lt;br /&gt;
&lt;br /&gt;
http://c2.com/cgi/wiki?SingletonPattern&lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/singleton-pattern.html&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/en-us/library/ff650316.aspx&lt;br /&gt;
&lt;br /&gt;
http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html&lt;br /&gt;
&lt;br /&gt;
http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern&lt;br /&gt;
&lt;br /&gt;
http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern&lt;br /&gt;
&lt;br /&gt;
http://www.roseindia.net/designpattern/singleton_pattern.shtml&lt;br /&gt;
&lt;br /&gt;
http://www.ibm.com/developerworks/webservices/library/co-single/index.html&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70804</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70804"/>
		<updated>2012-11-19T22:06:55Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, Directory of Sites=&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:3.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
== [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
== [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html Simply Singleton] ==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''':&lt;br /&gt;
Capabilities of Singleton pattern,Singleton design pattern class diagram, Example, use of protected constructors.&lt;br /&gt;
&lt;br /&gt;
'''Summary''':&lt;br /&gt;
The Singleton design pattern addresses all of the previous paragraph's concerns. With the Singleton design pattern you can:&lt;br /&gt;
* Ensure that only one instance of a class is created.&lt;br /&gt;
* Provide a global point of access to the object.&lt;br /&gt;
* Allow multiple instances in the future without affecting a singleton class's clients.&lt;br /&gt;
&lt;br /&gt;
As in , [http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html#resources Design Patterns], &amp;quot;Ensure a class has a single instance, and provide a global point of access to it&amp;quot;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:4.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
== [http://c2.com/cgi/wiki?SingletonPattern Singleton explained on c2.com]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Simulation of global variables, Appropriate Use of Singleton, Singleton in threaded environment&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly explains aspects like testing, creational logic,polymorphism involved in singleton pattern.It explains situations when singleton pattern can be used.It goes on to explain the anti-pattern of singletons simulating global variables and appropriate use of singleton in mutithreaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Problem of using Singleton in Multithreaded Environment''' : &lt;br /&gt;
&lt;br /&gt;
 static private synchronized Singleton instance_helper(){&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&amp;quot;_instance&amp;quot; can be null in the logic for multiple threads before instance_helper is called, leading to multiple instances being created&lt;br /&gt;
&lt;br /&gt;
'''Solution for Singleton in Multithreaded Environment''' : &lt;br /&gt;
 &lt;br /&gt;
 static private synchronized Singleton instance_helper()&lt;br /&gt;
 {&lt;br /&gt;
 if(flag)&lt;br /&gt;
 {&lt;br /&gt;
 _instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 flag = false;&lt;br /&gt;
 return _instance;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
== [http://www.oodesign.com/singleton-pattern.html Singleton Applications]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Motivation, Intent, Implementation, Applicability and Examples&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link gives some extra information about applicability of Singleton in logger classes,configuration classes, accessing resources in shared environment,factories implemented as Singleton,Implementations and problems involved&lt;br /&gt;
&lt;br /&gt;
'''Serialization''' :&lt;br /&gt;
&lt;br /&gt;
If the Singleton class implements the java.io.Serializable interface, when a singleton is serialized and then deserialized more than once, there will be multiple instances of Singleton created. In order to avoid this the readResolve method should be implemented. &lt;br /&gt;
&lt;br /&gt;
 public class Singleton implements Serializable {&lt;br /&gt;
 ...&lt;br /&gt;
 // This method is called immediately after an object of this class is deserialized.&lt;br /&gt;
 // This method returns the singleton instance.&lt;br /&gt;
 protected Object readResolve() {&lt;br /&gt;
 return getInstance();&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==[http://msdn.microsoft.com/en-us/library/ff650316.aspx Singleton Implementation in C#]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Implementation in C#&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link explains how to implement a singleton in C# both in static and threaded environment.&lt;br /&gt;
&lt;br /&gt;
'''Static Initialization''':&lt;br /&gt;
&lt;br /&gt;
One of the reasons Design Patterns [Gamma95] avoided static initialization is because the C++ specification left some ambiguity around the initialization order of static variables. Fortunately, the .NET Framework resolves this ambiguity through its handling of variable initialization:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
 public sealed class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static readonly Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton(){}&lt;br /&gt;
 public static Singleton Instance&lt;br /&gt;
 {&lt;br /&gt;
 get &lt;br /&gt;
 { &lt;br /&gt;
 return instance; &lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Implementing Singleton in C# results in the following benefits and liabilities:&lt;br /&gt;
&lt;br /&gt;
'''Benefits''':&lt;br /&gt;
*The static initialization approach is possible because the .NET Framework explicitly defines how and when static variable initialization occurs.&lt;br /&gt;
*The Double-Check Locking idiom described earlier in &amp;quot;Multithreaded Singleton&amp;quot; is implemented correctly in the common language runtime.&lt;br /&gt;
&lt;br /&gt;
'''Liabilities''':&lt;br /&gt;
If your multithreaded application requires explicit initialization, you have to take precautions to avoid threading issues.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== [http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html Refactor Singleton Out Of Your Code]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Solution to refactor singleton&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Gang of Four mentions Singleton as an anti-pattern and not as a pattern. This Link provides a solution to refactor Singleton out of the code&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
'''Steps to refactor Singleton:'''&lt;br /&gt;
* Create simple interface for Registry with two simple methods - getter and setter for instance of class which is currently implemented as singleton.&lt;br /&gt;
 public interface ISingletonRegistry {&lt;br /&gt;
 SingletonClass getSingletonClass();&lt;br /&gt;
 void setSingletonClass(SingletonClass singleton);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Make SingletonClass's constructor public&lt;br /&gt;
&lt;br /&gt;
* Then implement the interface as a simplest Registry design pattern implementation - SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
 public class SingletonRegistry implements ISingletonRegistry {&lt;br /&gt;
 private static final SingletonRegistry INSTANCE = new SingletonRegistry();&lt;br /&gt;
 private SingletonClass singleton;&lt;br /&gt;
 public static ISingletonRegistry getInstance() {&lt;br /&gt;
 return INSTANCE;&lt;br /&gt;
 }&lt;br /&gt;
 private SingletonRegistry() {&lt;br /&gt;
 //this is the reason why the constructor should be public&lt;br /&gt;
 singleton = new SingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
 public SingletonClass getSingletonClass() {&lt;br /&gt;
 return singleton;&lt;br /&gt;
 }&lt;br /&gt;
 public void setSingletonClass(SingletonClass singleton) {&lt;br /&gt;
 this.singleton = singleton;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Change getInstance method of SingletonClass to get instance from SingletonRegistry.&lt;br /&gt;
 public static SingletonClass getInstance() {&lt;br /&gt;
 return SingletonRegistry.getInstance().getSingletonClass();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* The method getInstance from SingletonClass disappears and all it's client classes uses SingletonRegistry to access SingletonClass.&lt;br /&gt;
 public class Client {&lt;br /&gt;
 public void clientMethod() {&lt;br /&gt;
 SingletonRegistry.getInstance() .getSingletonClass().voidMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 Object object = SingletonRegistry.getInstance() .getSingletonClass().objectMethod(&amp;quot;param&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Delete INSTANCE constant from SingletonClass class.&lt;br /&gt;
&lt;br /&gt;
* You can Extract Interface (Alt+Shift+T, E) from SingletonClass. Write just new interface name, select all methods from SingletonClass which you can extract into new interface and press OK. All references to SingletonClass will be refactored to references to your newly created interface.&lt;br /&gt;
&lt;br /&gt;
And that is all. Now you have SingletonClass with totally same functionality but you are able to mock it, extend or replace by different implementation setting up your instance of SingletonClass to SingletonRegistry.&lt;br /&gt;
&lt;br /&gt;
== [http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern/ Refactoring:Extracting the Singleton Pattern]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Extracting the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
Here, the author demonstrates the refactoring of Singleton Pattern by means of an example of a Device Manger class. So the main class that will be changing is the DeviceManager. This class manages a collection of Devices (or a dictionary, to be more precise) and allows to set which is the active device and to get a device by id. Note that this last feature could be handled by the Devices collection, but we are taking advantage of the dictionary to make that look-up more efficient.&lt;br /&gt;
&lt;br /&gt;
== [http://www.roseindia.net/designpattern/singleton_pattern.shtml Singleton Pattern Usage and Benefits]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Usage, Benefits, Example&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and usage in multithreaded environment.Singleton patterns are often used as global variables because the global variables permit allocation and initialization whenever required. They don't permit to pollute the global namespace with unnecessary variables.&lt;br /&gt;
&lt;br /&gt;
'''Example''':&lt;br /&gt;
 package singleton;&lt;br /&gt;
 public class Logger {&lt;br /&gt;
 private String fileName;&lt;br /&gt;
 private Properties properties;&lt;br /&gt;
 private Priority priority;&lt;br /&gt;
 private Logger() {&lt;br /&gt;
 logger = this;&lt;br /&gt;
 }&lt;br /&gt;
 public int getRegisteredLevel() {&lt;br /&gt;
 int i = 0;&lt;br /&gt;
 try {&lt;br /&gt;
 InputStream inputstream = getClass().getResourceAsStream(&amp;quot;Logger.properties&amp;quot;);&lt;br /&gt;
 properties.load(inputstream);&lt;br /&gt;
 inputstream.close();&lt;br /&gt;
 i = Integer.parseInt(properties.getProperty(&amp;quot;logger.registeredlevel&amp;quot;));&lt;br /&gt;
 if(i &amp;lt; 0 || i &amp;gt; 3)&lt;br /&gt;
 i = 0;&lt;br /&gt;
 }&lt;br /&gt;
 catch(Exception exception) {&lt;br /&gt;
 System.out.println(&amp;quot;Logger: Failed in the getRegisteredLevel method&amp;quot;);&lt;br /&gt;
 exception.printStackTrace();&lt;br /&gt;
 }&lt;br /&gt;
 return i;&lt;br /&gt;
 }&lt;br /&gt;
 public static void initialize() {&lt;br /&gt;
 logger = new Logger();&lt;br /&gt;
 }&lt;br /&gt;
 // singleton - pattern&lt;br /&gt;
 private static Logger logger;&lt;br /&gt;
 public static Logger getLogger() {&lt;br /&gt;
 return logger;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== [http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern Critique of the Singleton Pattern]==&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Critique of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link describes about the benefits like instance control and flexibility and drawbacks like overhead, development confusion and Object lifetime while using the singleton pattern.&lt;br /&gt;
&lt;br /&gt;
==[http://www.ibm.com/developerworks/webservices/library/co-single/index.html Use Singletons Wisely]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
When to use, Moving away from Singletons, Aggregating Singletons&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The programming community discourages using global data and objects. Still, there are times when an application needs a single instance of a given class and a global point of access to that class. The general solution is the design pattern known as singletons. However, singletons are unnecessarily difficult to test and may make strong assumptions about the applications that will use them. In this article the author discusses strategies for avoiding the singleton pattern for that majority of cases where it is not appropriate. He also describes the properties of some classes that are truly singletons.&lt;br /&gt;
&lt;br /&gt;
'''Aggregating Singletons: The Toolbox''':&lt;br /&gt;
Singleton abuse can be avoided by looking at the problem from a different angle. Suppose an application needs only one instance of a class and the application configures that class at startup: Why should the class itself be responsible for being a singleton? It seems quite logical for the application to take on this responsibility, since the application requires this kind of behavior. The application, not the component, should be the singleton. The application then makes an instance of the component available for any application-specific code to use. When an application uses several such components, it can aggregate them into what we have called a toolbox.&lt;br /&gt;
Put simply, the application's toolbox is a singleton that is responsible either for configuring itself or for allowing the application's startup mechanism to configure it. The general pattern of the Toolbox singleton is as shown in the example provided in this article&lt;br /&gt;
The Toolbox is itself a singleton, and it manages the lifetime of the various component instances. Either the application configures it, or it asks the application for configuration information in method initialize. Now the application can decide how many instances of which classes it requires. Changes in those decisions may affect application-specific code, but not reusable, infrastructure-level code. Moreover, testing infrastructure code is much easier, as those classes do not rely on the way in which any application may choose to use them.&lt;br /&gt;
&lt;br /&gt;
== [http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious When Not to Use Singleton]==&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Appropriate Use of the Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
The Gang of Four states that you'll want to use Singleton there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point or when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx&lt;br /&gt;
&lt;br /&gt;
http://www.javaworld.com/javaworld/jw-04-2003/jw-0425-designpatterns.html&lt;br /&gt;
&lt;br /&gt;
http://javapapers.com/design-patterns/singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
http://www.codeproject.com/Articles/307233/Singleton-Pattern-Positive-and-Negative-Aspects&lt;br /&gt;
&lt;br /&gt;
http://sourcemaking.com/design_patterns/singleton&lt;br /&gt;
&lt;br /&gt;
http://c2.com/cgi/wiki?SingletonPattern&lt;br /&gt;
&lt;br /&gt;
http://www.oodesign.com/singleton-pattern.html&lt;br /&gt;
&lt;br /&gt;
http://msdn.microsoft.com/en-us/library/ff650316.aspx&lt;br /&gt;
&lt;br /&gt;
http://bosy.dailydev.org/2007/08/refactor-singleton-out-of-your-code.html&lt;br /&gt;
&lt;br /&gt;
http://www.e-pedro.com/2010/05/refactoring-extracting-the-singleton-pattern&lt;br /&gt;
&lt;br /&gt;
http://www.dotnetobject.com/Thread-Benefits-of-Singleton-Pattern-and-Drawbacks-of-Singleton-Pattern&lt;br /&gt;
&lt;br /&gt;
http://www.roseindia.net/designpattern/singleton_pattern.shtml&lt;br /&gt;
&lt;br /&gt;
http://www.ibm.com/developerworks/webservices/library/co-single/index.html&lt;br /&gt;
&lt;br /&gt;
http://stackoverflow.com/questions/4074154/when-should-the-singleton-pattern-not-be-used-besides-the-obvious&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:4.jpg&amp;diff=70803</id>
		<title>File:4.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:4.jpg&amp;diff=70803"/>
		<updated>2012-11-19T22:05:49Z</updated>

		<summary type="html">&lt;p&gt;Smahish: uploaded a new version of &amp;amp;quot;File:4.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70020</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70020"/>
		<updated>2012-11-18T02:24:24Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:3.jpg|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:3.jpg&amp;diff=70019</id>
		<title>File:3.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:3.jpg&amp;diff=70019"/>
		<updated>2012-11-18T02:22:34Z</updated>

		<summary type="html">&lt;p&gt;Smahish: uploaded a new version of &amp;amp;quot;File:3.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70018</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70018"/>
		<updated>2012-11-18T02:20:34Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                       }&lt;br /&gt;
                    }&lt;br /&gt;
               }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
 private static final Singleton instance = new Singleton();&lt;br /&gt;
 private Singleton() {}&lt;br /&gt;
 public static Singleton getInstance() {&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70017</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70017"/>
		<updated>2012-11-18T02:19:39Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
 private static volatile SingletonDemo instance = null;&lt;br /&gt;
 private SingletonDemo() {	}&lt;br /&gt;
 public static SingletonDemo getInstance() {&lt;br /&gt;
 if (instance == null) {&lt;br /&gt;
   synchronized (SingletonDemo .class){&lt;br /&gt;
   if (instance == null) {&lt;br /&gt;
   instance = new SingletonDemo ();&lt;br /&gt;
                        }&lt;br /&gt;
            }&lt;br /&gt;
    }&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
    private static final Singleton instance = new Singleton();&lt;br /&gt;
&lt;br /&gt;
    private Singleton() {}&lt;br /&gt;
&lt;br /&gt;
    public static Singleton getInstance() {&lt;br /&gt;
        return instance;&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70016</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70016"/>
		<updated>2012-11-18T02:18:39Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. &lt;br /&gt;
For instance, Lazy initialization and Eager Initialization example codes are:&lt;br /&gt;
'''Lazy Initialization''':&lt;br /&gt;
 public class SingletonDemo {&lt;br /&gt;
	private static volatile SingletonDemo instance = null;&lt;br /&gt;
	&lt;br /&gt;
	private SingletonDemo() {	}&lt;br /&gt;
	&lt;br /&gt;
	public static SingletonDemo getInstance() {&lt;br /&gt;
		if (instance == null) {&lt;br /&gt;
                        synchronized (SingletonDemo .class){&lt;br /&gt;
			        if (instance == null) {&lt;br /&gt;
                                        instance = new SingletonDemo ();&lt;br /&gt;
                                }&lt;br /&gt;
                      }&lt;br /&gt;
		}&lt;br /&gt;
		return instance;&lt;br /&gt;
	}&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
'''Eager Initialization''':&lt;br /&gt;
 public class Singleton {&lt;br /&gt;
    private static final Singleton instance = new Singleton();&lt;br /&gt;
&lt;br /&gt;
    private Singleton() {}&lt;br /&gt;
&lt;br /&gt;
    public static Singleton getInstance() {&lt;br /&gt;
        return instance;&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70013</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70013"/>
		<updated>2012-11-18T02:15:15Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; &lt;br /&gt;
 Foo := Object clone &lt;br /&gt;
 Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70012</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70012"/>
		<updated>2012-11-18T02:14:24Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; Foo := Object clone ; Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
 class Singleton&lt;br /&gt;
 {&lt;br /&gt;
 private static Singleton instance;&lt;br /&gt;
 private static int numOfReference;&lt;br /&gt;
 private string code;&lt;br /&gt;
 private Singleton()&lt;br /&gt;
 {&lt;br /&gt;
 numOfReference = 0;&lt;br /&gt;
 code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 public static Singleton GetInstance()&lt;br /&gt;
 {&lt;br /&gt;
 if(instance == null)&lt;br /&gt;
 {&lt;br /&gt;
 instance = new Singleton();&lt;br /&gt;
 }&lt;br /&gt;
 numOfReference++;&lt;br /&gt;
 return instance;&lt;br /&gt;
 }&lt;br /&gt;
 public static int Reference&lt;br /&gt;
 {&lt;br /&gt;
 get { return numOfReference; }&lt;br /&gt;
 }&lt;br /&gt;
 public string Code&lt;br /&gt;
 {&lt;br /&gt;
 get { return code; }&lt;br /&gt;
 set { code = value;}&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
 class Singleton2&lt;br /&gt;
 {&lt;br /&gt;
 private static int numOfInstance = 0;&lt;br /&gt;
 public Singleton2()&lt;br /&gt;
 {&lt;br /&gt;
 if(numOfInstance == 0)&lt;br /&gt;
 {&lt;br /&gt;
 Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
 numOfInstance++;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
 + so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70011</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70011"/>
		<updated>2012-11-18T02:11:55Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; Foo := Object clone ; Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
&lt;br /&gt;
'''Case 1''' :&lt;br /&gt;
class Singleton&lt;br /&gt;
{&lt;br /&gt;
private static Singleton instance;&lt;br /&gt;
private static int numOfReference;&lt;br /&gt;
private string code;&lt;br /&gt;
private Singleton()&lt;br /&gt;
{&lt;br /&gt;
numOfReference = 0;&lt;br /&gt;
code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
public static Singleton GetInstance()&lt;br /&gt;
{&lt;br /&gt;
if(instance == null)&lt;br /&gt;
{&lt;br /&gt;
instance = new Singleton();&lt;br /&gt;
}&lt;br /&gt;
numOfReference++;&lt;br /&gt;
return instance;&lt;br /&gt;
}&lt;br /&gt;
public static int Reference&lt;br /&gt;
{&lt;br /&gt;
get { return numOfReference; }&lt;br /&gt;
}&lt;br /&gt;
public string Code&lt;br /&gt;
{&lt;br /&gt;
get { return code; }&lt;br /&gt;
set { code = value;}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
class Singleton2&lt;br /&gt;
{&lt;br /&gt;
private static int numOfInstance = 0;&lt;br /&gt;
public Singleton2()&lt;br /&gt;
{&lt;br /&gt;
if(numOfInstance == 0)&lt;br /&gt;
{&lt;br /&gt;
Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
numOfInstance++;&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
+ so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70009</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=70009"/>
		<updated>2012-11-18T02:10:53Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; Foo := Object clone ; Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Intent, Description, An Example, Implementation, Benefits&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The code for each case is given as follows: &lt;br /&gt;
'''Case 1''':&lt;br /&gt;
class Singleton&lt;br /&gt;
{&lt;br /&gt;
private static Singleton instance;&lt;br /&gt;
private static int numOfReference;&lt;br /&gt;
private string code;&lt;br /&gt;
private Singleton()&lt;br /&gt;
{&lt;br /&gt;
numOfReference = 0;&lt;br /&gt;
code = &amp;quot;Maasoom Faraz&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
public static Singleton GetInstance()&lt;br /&gt;
{&lt;br /&gt;
if(instance == null)&lt;br /&gt;
{&lt;br /&gt;
instance = new Singleton();&lt;br /&gt;
}&lt;br /&gt;
numOfReference++;&lt;br /&gt;
return instance;&lt;br /&gt;
}&lt;br /&gt;
public static int Reference&lt;br /&gt;
{&lt;br /&gt;
get { return numOfReference; }&lt;br /&gt;
}&lt;br /&gt;
public string Code&lt;br /&gt;
{&lt;br /&gt;
get { return code; }&lt;br /&gt;
set { code = value;}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The constructor is made private and used to initialize the numOfReference and default value of code. GetInstance() method checks the instance, if it is null then it assign it an instance of Singleton otherwise return the old reference.&lt;br /&gt;
&lt;br /&gt;
'''Case 2''' :&lt;br /&gt;
class Singleton2&lt;br /&gt;
{&lt;br /&gt;
private static int numOfInstance = 0;&lt;br /&gt;
public Singleton2()&lt;br /&gt;
{&lt;br /&gt;
if(numOfInstance == 0)&lt;br /&gt;
{&lt;br /&gt;
Console.WriteLine(&amp;quot;\r\nCreating First Object of Singleton2 class...&amp;quot;);&lt;br /&gt;
numOfInstance++;&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
throw new Exception(&amp;quot;This class is Singleton,&lt;br /&gt;
+ so only one object of it can be instantiated.&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
Here we make the constructor public and use a private field numOfInstance which is incremented for each constructor call. If numOfInstance is zero (no object is yet instantiated), a new object is allowed to made. But, if this value is not zero (there is already an object of Singleton2 class, an exception is thrown.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69994</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69994"/>
		<updated>2012-11-18T00:57:41Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; Foo := Object clone ; Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
It firstly talks about the intent behind singleton design pattern, in that there is a need to have a class that can be instantiated only once.&lt;br /&gt;
Then, it describes two solutions for implementing the singleton class. &lt;br /&gt;
In the first, there should be only one shared object and reference to that shared object should be available through a static method GetInstance() while the constructor is private.&lt;br /&gt;
The second solution expects the constructor to be public but once an object has been instantiated, an exception should be thrown for each successive constructor call.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:1.gif|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:1.gif&amp;diff=69993</id>
		<title>File:1.gif</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:1.gif&amp;diff=69993"/>
		<updated>2012-11-18T00:47:24Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69991</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69991"/>
		<updated>2012-11-18T00:41:06Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
===[http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]===&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; Foo := Object clone ; Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton - Creational Design Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69990</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69990"/>
		<updated>2012-11-18T00:26:50Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. [http://en.wikipedia.org/wiki/Singleton_pattern Singleton on the Wikipedia]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; Foo := Object clone ; Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. [http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/ Learn Singleton-design-Pattern]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. [http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx Singleton with C-Sharp]&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69984</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69984"/>
		<updated>2012-11-17T23:56:55Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; Foo := Object clone ; Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
'''Drawbacks''' :&lt;br /&gt;
The pattern makes unit testing far more difficult as it introduces global state into an application. It should also be noted that this pattern reduces the potential for parallelism within a program, because access to the singleton in a multi-threaded context must be serialized.&lt;br /&gt;
&lt;br /&gt;
2. http://www.c-sharpcorner.com/UploadFile/SukeshMarla/learn-design-pattern-singleton-pattern/&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
Definition, When to use, how to create, Sharing across all users, Sharing across a request, Sharing across a single user&lt;br /&gt;
&lt;br /&gt;
'''Summary''' :&lt;br /&gt;
This article explains what Singleton pattern is, what kind of problem it generally solves and how should it be implemented in ASP.NET. The Singleton pattern which ensures that only one instance of a given object can exist at a context solves problems related to object creation and hence is a type of creational pattern.&lt;br /&gt;
&lt;br /&gt;
It can be used in a class that wraps the settings related to an application. In other words, whenever we want something to be shared across multiple locations, we use a singleton pattern. In order to create a Singleton pattern, we can render the constructor private so that no user can create a new instance outside the class, that way ensuring only one instance of the objects always exists. In that case, we also need to create a static method that returns the single object.&lt;br /&gt;
&lt;br /&gt;
Singleton patterns in ASP.NET are implemented by using static objects which maintain their values and reside in the memory as long as the application which contains it does. The sharing can occur across users, or requests or across a single user.&lt;br /&gt;
&lt;br /&gt;
3. http://www.c-sharpcorner.com/UploadFile/faraz.rasheed/SingletonPattern12052005063955AM/SingletonPattern.aspx&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69980</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69980"/>
		<updated>2012-11-17T23:33:51Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
Lazy initialization uses double-checking and eager initialization which always creates an instance. It also talks about Prototype-based programming in which objects but not classes are used, a 'singleton' simply refers to an object without copies or that is not used as the prototype for any other object. Eg :-&amp;gt; Foo := Object clone ; Foo clone := Foo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69977</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69977"/>
		<updated>2012-11-17T21:53:53Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
A lazy and Eager initialization in java&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69976</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69976"/>
		<updated>2012-11-17T21:53:37Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
'''Topics Covered''' : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
'''Summary''' : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
A lazy and Eager initialization in java &lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69975</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69975"/>
		<updated>2012-11-17T21:52:34Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
Topics Covered : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
Summary : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
A lazy and Eager initialization in java &lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69974</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69974"/>
		<updated>2012-11-17T21:51:51Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
Topics Covered : &lt;br /&gt;
Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
Summary : &lt;br /&gt;
This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
A lazy and Eager initialization in java &lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69973</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69973"/>
		<updated>2012-11-17T21:49:13Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
    Topics Covered : &lt;br /&gt;
    Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
    Summary : &lt;br /&gt;
    This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
    Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
    A lazy and Eager initialization in java &lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69972</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69972"/>
		<updated>2012-11-17T21:48:09Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Singleton, directory of sites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Topics Covered : &lt;br /&gt;
&lt;br /&gt;
    Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Summary : &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
&lt;br /&gt;
    A lazy and Eager initialization in java &lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69971</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69971"/>
		<updated>2012-11-17T21:46:05Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
1. http://en.wikipedia.org/wiki/Singleton_pattern&lt;br /&gt;
    Topics Covered : Common uses, UML, Implementation, Example, Prototype based singleton, Example of use with factory method pattern&lt;br /&gt;
    Summary : &lt;br /&gt;
    This link firstly provides the basic definition of the singleton pattern as a design pattern that restricts the instantiation of a class to one object. Singleton patters are mostly used in Abstract Factory, Builder, and Prototype, and Facade patterns. &lt;br /&gt;
    Both the UML representation of singleton where the same single instance is always returned and the implementation concerning the mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among the class objects. The link also points out that if a class has to realize a contract expressed by an interface, it really has to be a singleton.&lt;br /&gt;
    A lazy and Eager initialization in java &lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69970</id>
		<title>CSC/ECE 517 Fall 2012/ch2b 2w53 iv</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch2b_2w53_iv&amp;diff=69970"/>
		<updated>2012-11-17T21:12:42Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Singleton, directory of sites=&lt;br /&gt;
==Singleton, directory of sites Pattern==&lt;br /&gt;
&lt;br /&gt;
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
*[http://catalog.lib.ncsu.edu/record/NCSU1994709 Head First Design Patterns]&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67269</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67269"/>
		<updated>2012-10-04T03:26:24Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Creating a CRC model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
The CRC-card approach is especially well suited, when the problem is not well defined. During object-oriented analysis, the problem and the application domains are analysed to understand the problem at hand. The steps in creating a CRC model are as follows:&lt;br /&gt;
&lt;br /&gt;
* Find candidate classes by means of brainstorming &lt;br /&gt;
&lt;br /&gt;
* Filter the list of candidates &lt;br /&gt;
&lt;br /&gt;
* Create CRC-cards for the remaining candidates &lt;br /&gt;
&lt;br /&gt;
* Allocate responsibilities to CRC-cards/classes &lt;br /&gt;
&lt;br /&gt;
* Define scenarios to test/evaluate our model &lt;br /&gt;
&lt;br /&gt;
* Prepare the group session &lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Role-play&amp;quot; scenarios using CRC-cards &lt;br /&gt;
&lt;br /&gt;
* Record scenarios  and&lt;br /&gt;
&lt;br /&gt;
* Update CRC-cards and scenarios to reflect your findings (6.9).&lt;br /&gt;
&lt;br /&gt;
These steps need not be performed in strict sequence. When filtering the list of candidates, usually all possible responsibilities should be considered in order to be able to make an informed decision. The last three steps are generally always performed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''It’s simple and straightforward''': You get a group of people together in a room and fill out a bunch of index cards. Because of its simplicity you can explain CRC modeling to a group of people in 10 or 15 minutes.&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Increased user participation''': Because users are actively involved in defining the model their satisfaction with the work will be much greater&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
* '''Prototyping''': CRC modeling and prototyping are both iterative processes in which users are greatly involved. It is very common to draw rough sketches of screens and reports during CRC modeling sessions.&lt;br /&gt;
&lt;br /&gt;
* '''Class diagramming''': CRC modeling leads directly into class diagramming. CRC models and class diagrams show many of the same concepts.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;br /&gt;
* http://www.cs.uakron.edu/~xiao/oop/CRC-S.ppt&lt;br /&gt;
* http://www.uml.org.cn/umlapplication/pdf/crcmodeling.pdf&lt;br /&gt;
* http://en.wikipedia.org/wiki/Class-responsibility-collaboration_card&lt;br /&gt;
* http://c2.com/cgi/wiki?WardAndRalphInNewOrleans&lt;br /&gt;
* Skrien, Dale John. Object-oriented Design Using Java. Boston: McGraw-Hill Higher Education, 2009. Print&lt;br /&gt;
* http://en.wikipedia.org/wiki/Software_Ideas_Modeler&lt;br /&gt;
* http://findfiles.com/14090/details-quickcrc-macosx.html&lt;br /&gt;
* http://www.easycrc.com/&lt;br /&gt;
* http://alistair.cockburn.us/Using+CRC+cards&lt;br /&gt;
* http://en.wikipedia.org/wiki/Visual_Paradigm_for_UML&lt;br /&gt;
* http://www.visual-paradigm.com/product/vpuml/&lt;br /&gt;
* http://books.google.com/books/about/Using_CRC_Cards.html?id=baopCOstm_kC&lt;br /&gt;
* http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_5_as&lt;br /&gt;
* http://www.cc.gatech.edu/ectropic/papers :K. A. Gray, M. Guzdial, and S. Rugaber. Extending CRC cards into a complete design process. Technical report, College of Computing, Georgia Institute of Technology, Atlanta, GA, 2002.&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67142</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67142"/>
		<updated>2012-10-04T02:02:49Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Advantages of CRC cards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''It’s simple and straightforward''': You get a group of people together in a room and fill out a bunch of index cards. Because of its simplicity you can explain CRC modeling to a group of people in 10 or 15 minutes.&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Increased user participation''': Because users are actively involved in defining the model their satisfaction with the work will be much greater&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
* '''Prototyping''': CRC modeling and prototyping are both iterative processes in which users are greatly involved. It is very common to draw rough sketches of screens and reports during CRC modeling sessions.&lt;br /&gt;
&lt;br /&gt;
* '''Class diagramming''': CRC modeling leads directly into class diagramming. CRC models and class diagrams show many of the same concepts.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;br /&gt;
* http://www.cs.uakron.edu/~xiao/oop/CRC-S.ppt&lt;br /&gt;
* http://www.uml.org.cn/umlapplication/pdf/crcmodeling.pdf&lt;br /&gt;
* http://en.wikipedia.org/wiki/Class-responsibility-collaboration_card&lt;br /&gt;
* http://c2.com/cgi/wiki?WardAndRalphInNewOrleans&lt;br /&gt;
* Skrien, Dale John. Object-oriented Design Using Java. Boston: McGraw-Hill Higher Education, 2009. Print&lt;br /&gt;
* http://en.wikipedia.org/wiki/Software_Ideas_Modeler&lt;br /&gt;
* http://findfiles.com/14090/details-quickcrc-macosx.html&lt;br /&gt;
* http://www.easycrc.com/&lt;br /&gt;
* http://alistair.cockburn.us/Using+CRC+cards&lt;br /&gt;
* http://en.wikipedia.org/wiki/Visual_Paradigm_for_UML&lt;br /&gt;
* http://www.visual-paradigm.com/product/vpuml/&lt;br /&gt;
* http://books.google.com/books/about/Using_CRC_Cards.html?id=baopCOstm_kC&lt;br /&gt;
* http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_5_as&lt;br /&gt;
* http://www.cc.gatech.edu/ectropic/papers :K. A. Gray, M. Guzdial, and S. Rugaber. Extending CRC cards into a complete design process. Technical report, College of Computing, Georgia Institute of Technology, Atlanta, GA, 2002.&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67139</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67139"/>
		<updated>2012-10-04T02:02:04Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Advantages of CRC cards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''It’s simple and straightforward''': You get a group of people together in a room and fill out a bunch of index cards. Because of its simplicity you can explain CRC modeling to a group of people in 10 or 15 minutes.&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Increased user participation''': Because users are actively involved in defining the model their&lt;br /&gt;
satisfaction with the work will be much greater&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
* '''Prototyping''': CRC modeling and prototyping are both iterative processes in which users are greatly involved. It is very common to draw rough sketches of screens and reports during CRC modeling sessions.&lt;br /&gt;
&lt;br /&gt;
* '''Class diagramming''': CRC modeling leads directly into class diagramming. CRC models and class diagrams show many of the same concepts.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;br /&gt;
* http://www.cs.uakron.edu/~xiao/oop/CRC-S.ppt&lt;br /&gt;
* http://www.uml.org.cn/umlapplication/pdf/crcmodeling.pdf&lt;br /&gt;
* http://en.wikipedia.org/wiki/Class-responsibility-collaboration_card&lt;br /&gt;
* http://c2.com/cgi/wiki?WardAndRalphInNewOrleans&lt;br /&gt;
* Skrien, Dale John. Object-oriented Design Using Java. Boston: McGraw-Hill Higher Education, 2009. Print&lt;br /&gt;
* http://en.wikipedia.org/wiki/Software_Ideas_Modeler&lt;br /&gt;
* http://findfiles.com/14090/details-quickcrc-macosx.html&lt;br /&gt;
* http://www.easycrc.com/&lt;br /&gt;
* http://alistair.cockburn.us/Using+CRC+cards&lt;br /&gt;
* http://en.wikipedia.org/wiki/Visual_Paradigm_for_UML&lt;br /&gt;
* http://www.visual-paradigm.com/product/vpuml/&lt;br /&gt;
* http://books.google.com/books/about/Using_CRC_Cards.html?id=baopCOstm_kC&lt;br /&gt;
* http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_5_as&lt;br /&gt;
* http://www.cc.gatech.edu/ectropic/papers :K. A. Gray, M. Guzdial, and S. Rugaber. Extending CRC cards into a complete design process. Technical report, College of Computing, Georgia Institute of Technology, Atlanta, GA, 2002.&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67137</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67137"/>
		<updated>2012-10-04T02:01:42Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Advantages of CRC cards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''It’s simple and straightforward''': You get a group of people together in a room and fill out a bunch&lt;br /&gt;
of index cards. Because of its simplicity you can explain CRC modeling to a group of people in 10 or&lt;br /&gt;
15 minutes.&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Increased user participation''': Because users are actively involved in defining the model their&lt;br /&gt;
satisfaction with the work will be much greater&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
* '''Prototyping''': CRC modeling and prototyping are both iterative processes in which users are greatly involved. It is very common to draw rough sketches of screens and reports during CRC modeling sessions.&lt;br /&gt;
&lt;br /&gt;
* '''Class diagramming''': CRC modeling leads directly into class diagramming. CRC models and class diagrams show many of the same concepts.&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;br /&gt;
* http://www.cs.uakron.edu/~xiao/oop/CRC-S.ppt&lt;br /&gt;
* http://www.uml.org.cn/umlapplication/pdf/crcmodeling.pdf&lt;br /&gt;
* http://en.wikipedia.org/wiki/Class-responsibility-collaboration_card&lt;br /&gt;
* http://c2.com/cgi/wiki?WardAndRalphInNewOrleans&lt;br /&gt;
* Skrien, Dale John. Object-oriented Design Using Java. Boston: McGraw-Hill Higher Education, 2009. Print&lt;br /&gt;
* http://en.wikipedia.org/wiki/Software_Ideas_Modeler&lt;br /&gt;
* http://findfiles.com/14090/details-quickcrc-macosx.html&lt;br /&gt;
* http://www.easycrc.com/&lt;br /&gt;
* http://alistair.cockburn.us/Using+CRC+cards&lt;br /&gt;
* http://en.wikipedia.org/wiki/Visual_Paradigm_for_UML&lt;br /&gt;
* http://www.visual-paradigm.com/product/vpuml/&lt;br /&gt;
* http://books.google.com/books/about/Using_CRC_Cards.html?id=baopCOstm_kC&lt;br /&gt;
* http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_5_as&lt;br /&gt;
* http://www.cc.gatech.edu/ectropic/papers :K. A. Gray, M. Guzdial, and S. Rugaber. Extending CRC cards into a complete design process. Technical report, College of Computing, Georgia Institute of Technology, Atlanta, GA, 2002.&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67130</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67130"/>
		<updated>2012-10-04T01:57:16Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Member involvement''': The level of involvement felt by each team member increases.&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;br /&gt;
* http://www.cs.uakron.edu/~xiao/oop/CRC-S.ppt&lt;br /&gt;
* http://www.uml.org.cn/umlapplication/pdf/crcmodeling.pdf&lt;br /&gt;
* http://en.wikipedia.org/wiki/Class-responsibility-collaboration_card&lt;br /&gt;
* http://c2.com/cgi/wiki?WardAndRalphInNewOrleans&lt;br /&gt;
* Skrien, Dale John. Object-oriented Design Using Java. Boston: McGraw-Hill Higher Education, 2009. Print&lt;br /&gt;
* http://en.wikipedia.org/wiki/Software_Ideas_Modeler&lt;br /&gt;
* http://findfiles.com/14090/details-quickcrc-macosx.html&lt;br /&gt;
* http://www.easycrc.com/&lt;br /&gt;
* http://alistair.cockburn.us/Using+CRC+cards&lt;br /&gt;
* http://en.wikipedia.org/wiki/Visual_Paradigm_for_UML&lt;br /&gt;
* http://www.visual-paradigm.com/product/vpuml/&lt;br /&gt;
* http://books.google.com/books/about/Using_CRC_Cards.html?id=baopCOstm_kC&lt;br /&gt;
* http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_5_as&lt;br /&gt;
* http://www.cc.gatech.edu/ectropic/papers :K. A. Gray, M. Guzdial, and S. Rugaber. Extending CRC cards into a complete design process. Technical report, College of Computing, Georgia Institute of Technology, Atlanta, GA, 2002.&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67121</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67121"/>
		<updated>2012-10-04T01:51:17Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Member involvement''': The level of involvement felt by each team member increases.&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;br /&gt;
* http://www.cs.uakron.edu/~xiao/oop/CRC-S.ppt&lt;br /&gt;
* http://www.uml.org.cn/umlapplication/pdf/crcmodeling.pdf&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67117</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67117"/>
		<updated>2012-10-04T01:49:00Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Member involvement''': The level of involvement felt by each team member increases.&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;br /&gt;
* http://www.cs.uakron.edu/~xiao/oop/CRC-S.ppt&lt;br /&gt;
* http://www.uml.org.cn/umlapplication/pdf/crcmodeling.pdf&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67116</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67116"/>
		<updated>2012-10-04T01:48:06Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Member involvement''': The level of involvement felt by each team member increases.&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67115</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67115"/>
		<updated>2012-10-04T01:47:51Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Member involvement''': The level of involvement felt by each team member increases.&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67112</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67112"/>
		<updated>2012-10-04T01:47:38Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Member involvement''': The level of involvement felt by each team member increases.&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67108</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67108"/>
		<updated>2012-10-04T01:46:45Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Member involvement''': The level of involvement felt by each team member increases.&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_aa&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_sd&lt;br /&gt;
* http://expertiza.csc.ncsu.edu/wiki/index.php/CSC/ECE_517_Fall_2011/ch4_4i_js&lt;br /&gt;
* http://www.excelsoftware.com/quickcrcintro&lt;br /&gt;
* https://sites.google.com/site/easycrc/&lt;br /&gt;
* Beck, Kent; Cunningham, Ward (October 1989), &amp;quot;A laboratory for teaching object oriented thinking&amp;quot;, ACM SIGPLAN Notices (New York, NY, USA: ACM) 24 (10): 1–6, doi:10.1145/74878.74879, ISBN 0-89791-333-7&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67097</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67097"/>
		<updated>2012-10-04T01:41:13Z</updated>

		<summary type="html">&lt;p&gt;Smahish: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Member involvement''': The level of involvement felt by each team member increases.&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
* [http://www.runrev.com/home/ Revolution]&lt;br /&gt;
* [http://pythoncard.sourceforge.net/ PythonCard]&lt;br /&gt;
* [http://www.supercard.us/supercard/index.html SuperCard]&lt;br /&gt;
* [http://c2.com/cgi/wiki?HyperCard HyperCard] and the [http://finance.groups.yahoo.com/group/HyperCard/ HyperCard Group]&lt;br /&gt;
* [http://www.metacard.com/ MetaCard] and the [http://tech.groups.yahoo.com/group/MC_IDE/ MetaCard Group]&lt;br /&gt;
* [http://freecard.sourceforge.net/website/ FreeCard] and the [http://tech.groups.yahoo.com/group/freegui/ FreeCard Group]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Unified_Modeling_Language Unified Modeling Language]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Responsibility-driven_design Responsibility-driven Design]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Object-oriented_design Object-Oriented Design]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Meta-modeling MetaModeling]&lt;br /&gt;
# [http://coweb.cc.gatech.edu/cs2340/6046 CRC and Scenario]&lt;br /&gt;
# [http://c2.com/doc/oopsla89/paper.html Object Oriented Thinking]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Requirements_analysis Requirement Analysis]&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67093</id>
		<title>CSC/ECE 517 Fall 2012/ch1 w43</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2012/ch1_w43&amp;diff=67093"/>
		<updated>2012-10-04T01:38:30Z</updated>

		<summary type="html">&lt;p&gt;Smahish: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Class-Responsibilty-Collaboration Cards=&lt;br /&gt;
'''Class Responsibility Collaboration (CRC) cards''' are a brainstorming tool used in the design of object-oriented software. They were proposed by and [http://en.wikipedia.org/wiki/Ward_Cunningham Ward Cunningham] and [http://en.wikipedia.org/wiki/Kent_Beck Kent Beck]. They are typically used when first determining which classes are needed and how they will interact.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
CRC-cards are a lightweight approach to collaborative object-oriented modelling that has been developed as a tool for teaching object-oriented thinking to programmers. They have been used widely in various teaching and training contexts.&lt;br /&gt;
&lt;br /&gt;
A CRC-card corresponds to a '''class'''. A '''responsibility''' is something the objects of a class know or do as a service for other objects. The responsibilities of the objects of a class are written along the left side of the card. A '''collaborator''' is an object of another class &amp;quot;helping&amp;quot; to fulfill a specific responsibility.&lt;br /&gt;
&lt;br /&gt;
The back of the card can be used for a brief description of the class' purpose, comments and miscellaneous details.&lt;br /&gt;
&lt;br /&gt;
The structure of a CRC-card is as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:CRC_example.jpg|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
CRC cards are usually created from [http://en.wikipedia.org/wiki/Index_card index cards] on which there are written:&lt;br /&gt;
&lt;br /&gt;
1. The class name&lt;br /&gt;
&lt;br /&gt;
2. Its Super and Sub classes (if applicable)&lt;br /&gt;
&lt;br /&gt;
3. The responsibilities of the class.&lt;br /&gt;
&lt;br /&gt;
4. The names of other classes with which the class will collaborate to fulfill its responsibilities.&lt;br /&gt;
&lt;br /&gt;
5. Author&lt;br /&gt;
&lt;br /&gt;
Using a small card keeps the complexity of the design at a minimum. It focuses the designer on the essentials of the class and prevents her/him from getting into its details and inner workings at a time when such detail is probably counter-productive. It also forces the designer to refrain from giving the class too many responsibilities. Because the cards are portable, they can easily be laid out on a table and re-arranged while discussing a design with other people.&lt;br /&gt;
&lt;br /&gt;
A common method to determine what cards should be created is to read a specification for the problem under specification and consider if each noun should be a class and if each verb should be a responsibility of the noun or class to which it belongs. Naturally, the existence of a noun or verb does not require a class or responsibility in the program, but it is considered a good starting point.&lt;br /&gt;
&lt;br /&gt;
== CRC Models ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC model is a collection of CRC cards that represent whole or part of an application or problem&lt;br /&gt;
domain.  The most common use for CRC models is to gather and define the user requirements for an object-oriented application.  The figure below presents an example CRC model for a shipping/inventory control system, showing the CRC cards as they would be placed on a desk or work table.  Note the placement of the cards: Cards that collaborate with one another are close to each other, cards that don’t collaborate are not near each other.&lt;br /&gt;
&lt;br /&gt;
[[File:Crc_model.PNG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating a CRC model ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The steps in creating a CRC model are:&lt;br /&gt;
&lt;br /&gt;
1.  Put together the CRC modeling team.&lt;br /&gt;
&lt;br /&gt;
2.  Organize the modeling room.&lt;br /&gt;
&lt;br /&gt;
3.  Do some brainstorming.&lt;br /&gt;
&lt;br /&gt;
4.  Explain the CRC modeling technique.&lt;br /&gt;
&lt;br /&gt;
5.  Iteratively perform the steps of CRC modeling.&lt;br /&gt;
&lt;br /&gt;
6.  Perform use-case scenario testing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example of a CRC card ==&lt;br /&gt;
The CRC card for a class ''Book'' is as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Book_example.JPG|center|x300px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A CRC card corresponds to a '''class'''. It describes the common properties of certain kinds of objects of interest in a particular problem. An object can be any abstract or real world entity. Each class must have a single, well-defined purpose that can be described clearly. The class-name is written across the top of the class with a short description of the purpose of the class written at the back of the card.&lt;br /&gt;
&lt;br /&gt;
A '''responsibility''' is a service provided by an object of a class for other objects. It could either be something that must be done or something that must be known. For example, an object of class book might be responsible for checking itself out, knowing its title, etc. To do something, an object makes use of its own knowledge and if that is insufficient, it takes help from other objects(its collaborators). The responsibilities of an object are written on the left of the card.  &lt;br /&gt;
&lt;br /&gt;
The '''collaborators''' indicates which objects can be asked for help to fulfill a specific responsibility. An object of the collaborator class can provide further information required for the completion of a particular responsibility or it can also take over the parts of the original responsibility. For example, a book object will know if its overdue only if it knows the current date. The collaborators are listed to the right of the card.&lt;br /&gt;
&lt;br /&gt;
== Advantages of CRC cards ==&lt;br /&gt;
&lt;br /&gt;
* '''Language independent''': This approach is low-tech and independent of programming languages which makes it easy for collaborative modeling in teams with people from different backgrounds(analysts, developers, users, etc.)&lt;br /&gt;
&lt;br /&gt;
* '''Easy to test''': Through scenarios and role-plays, it is possible to easily test alternative analysis and design models using different cards and different responsibilities. In this way, it is possible to perform a variety of tests long before the code is actually written.&lt;br /&gt;
&lt;br /&gt;
* '''Formal Analysis''': CRC cards provide a basis for more formal analysis and design methodologies.&lt;br /&gt;
&lt;br /&gt;
* '''Life Cycle''': CRC cards are useful throughout the life cycle.&lt;br /&gt;
&lt;br /&gt;
* '''Portable''': CRC cards can be used anywhere, even away from the computer or office.&lt;br /&gt;
&lt;br /&gt;
* '''Member involvement''': The level of involvement felt by each team member increases.&lt;br /&gt;
&lt;br /&gt;
* '''Ease of transition''': CRC cards eases the transition from process orientation to object orientation .&lt;br /&gt;
&lt;br /&gt;
== Disadvantages of CRC cards ==&lt;br /&gt;
* '''It is threatening to some developers''':Many developers do not feel the need to work closely with the users as they feel that since they know the technology, they know the business too. This is, however, not true as the users also work with with the technology on a regular basis due to which there may be times when the users may know more than the developers themselves.&lt;br /&gt;
&lt;br /&gt;
* '''It is hard to get users together''': There may be times when it would be difficult to get everyone together and to schedule a meeting. It would be better to limit the meetings to only a few key people.&lt;br /&gt;
&lt;br /&gt;
* '''CRC cards are limited''': CRC models are just part of the definition of user requirements for an OO-application; you should also consider use cases, prototypes, and formal requirements documents.Furthermore, in most organizations it isn’t acceptable to simply submit a collection of index cards as your analysis deliverable.&lt;br /&gt;
&lt;br /&gt;
= CRC card tools =&lt;br /&gt;
There are many CRC tools available which are implemented in the form of software packages that provide different types of services to the users. Some of them are discussed below.&lt;br /&gt;
&lt;br /&gt;
== Stickies == &lt;br /&gt;
&lt;br /&gt;
One of the most simplest ways to produce CRC cards is by using applications like [http://www.youtube.com/watch?v=M1DscVsO2uE Stickies] on Mac OSX and [http://windows.microsoft.com/en-US/windows7/products/features/sticky-notes Sticky Notes] on Microsoft Windows 7. Both pieces of software can hold all the information that physical CRC cards contain.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:Stickies.png|x300px]]&lt;br /&gt;
|[[File:Stickynotes1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Hot Draw ==&lt;br /&gt;
&lt;br /&gt;
[http://c2.com/cgi/wiki?HotDraw Hot Draw] is a [http://en.wikipedia.org/wiki/Software_framework framework] for developing drawing programs (programs that allow users to create pictures and graphics). Hot Draw is more of a genesis for CRC card design rather than any CRC-card application. &lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! || &lt;br /&gt;
|-&lt;br /&gt;
| [[File:JHotDraw.PNG|x287px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Originally started as an exercise in design pattern best-practices, this piece of software allows one to effectively create and organize CRC, at least in a rudimentary sense.&lt;br /&gt;
&lt;br /&gt;
As '''Hot Draw''' is a framework, an application needs to be built that actually utilizes it. One such application is [http://www.jhotdraw.org/ JHotDraw], developed in part by [http://en.wikipedia.org/wiki/Erich_Gamma Erich Gamma] of &amp;quot;http://en.wikipedia.org/wiki/Design_Patterns Gang of Four]&amp;quot; fame. As seen above, rectangles (cards) can be created, and the required lines and text can be filled in. To effectively move and group cards, all of the individual components (lines, texts, drawings) must be group. The software allows for color customization, but overall the software specialized application toward the creation of CRC cards is quite limited.&lt;br /&gt;
&lt;br /&gt;
== QuickCRC ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Quick CRC''' is a commercial software development tool that has been developed by Excel Software to automate responsibility driven design of object-oriented software. It automates CRC cards for identifying classes, responsibilities and collaborations between objects by designing and simulating scenarios. Complex designs can be partitioned into multiple diagrams. The inheritance graph instantly shows the class structure of the evolving design. Quick CRC is supported on both Windows and Mac OS.&lt;br /&gt;
&lt;br /&gt;
Software designers can quickly identify object classes, relationships and related information before writing code. CRC cards are well suited to agile methods or as a front-end to UML.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:675px-Quickcrc.jpg|center|x300px|Quick CRC Tool]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
QuickCRC can generate inheritance graphs from information on CRC cards. These diagrams concisely illustrate the big picture of a large project that might contain thousands of classes and hundreds of diagrams.&lt;br /&gt;
&lt;br /&gt;
[[File:Qcrc13.gif|center|x300px|Inheritance Graph]]&lt;br /&gt;
&lt;br /&gt;
A few popular features used in this tool are :&lt;br /&gt;
*A set of existing cards pop up and we can add subclasses and superclasses to existing classes.&lt;br /&gt;
*This tool provides namespace support for partitioning the cards into different functional areas which can be used while listing specifications, printing cards or exporting information to other tools.&lt;br /&gt;
*It can generate the inheritance graphs from the information on the CRC cards.&lt;br /&gt;
*Linking cards and scenarios to foreign documents is made easy and thus they can  be easily accessed with a single click of the mouse.&lt;br /&gt;
*Information can be exported to other development tools as the CRC cards can be exported to MacA&amp;amp;D, WinA&amp;amp;D or QuickUML to auto-generate UML class diagrams.&lt;br /&gt;
*It can generate a text or HTML coding specification, generate cards, attributes and responsibilities from selected words in a text file or selectively print CRC cards for a peer review. Design work is saved as an XML file.&lt;br /&gt;
&lt;br /&gt;
== Easy CRC ==&lt;br /&gt;
&lt;br /&gt;
A tool that effectively consolidates the best use of CRC cards and sequence diagrams is the '''Easy CRC''' tool.EasyCRC is the only tool that focuses on CRC cards and scenarios unlike many other tools that focus more on the implementation view of the underlying system.&lt;br /&gt;
The use of the '''Easy CRC''' tool is divided into two categories:&lt;br /&gt;
* It helps in identifying the object, which are the CRC cards, from plain regular language.&lt;br /&gt;
* It identifies the collaborators and responsibilities by simulating scenarios using sequence diagrams. This tool makes use of the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Easy CRC offers a vibrant text editor in which the entire description can be copy-pasted and the tool automatically picks out the noun in the description and lists them. We can select the most appropriate nouns from the list and add them to the noun list.We can also select the words that were not listed by the tool by highlighting the word and adding it to noun list.&lt;br /&gt;
&lt;br /&gt;
There are two ways to update the responsibilities and collaborators in CRC diagram. &lt;br /&gt;
* Firstly, Enter all the values manually. &lt;br /&gt;
* Secondly, Draw the sequence diagrams first and from these diagrams the responsibilities and collaborators of a class would be identified and updated.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:438px-EasyCRC2.png|x300px]]&lt;br /&gt;
|[[File:517px-EasyCRC1.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Software Ideas Modeler ==&lt;br /&gt;
&lt;br /&gt;
Software Ideas Modeler is a lightweight and powerful CASE [http://en.wikipedia.org/wiki/Computer-aided_software_engineering CASE] tool by Dusan Rodina. It supports UML 2.2 diagrams and a lot of other ones. Software Ideas Modeler is freeware (for non-commercial use). Commercial user may use this software only after buying a license.&lt;br /&gt;
&lt;br /&gt;
The tool initially shows up all the 14 types of diagrams it supports and asks to choose one among them. After selecting CRC diagram, a diagram toolbox is opened. From there we can select a new CRC card or a link and few other shapes are also provided. When a new CRC card is added, the name can be changed by clicking the name box. The propertied can be edited by double clicking the crc card. This opens up a property pop up box. All the required details can be filled up.&lt;br /&gt;
&lt;br /&gt;
This tool is fairly simple to use and also allows the user to customize the card properties. It supports various types of automatic alignment for diagram elements. Diagram can be zoomed. There are also implemented standard functions as undo/redo and work with clipboard. Diagram elements can be styled (background color, text color, fonts, border), grouped, placed in layers. The tool also provides an additional feature of including the subclasses and superclass of the class in discussion. Every field value can be modified and renamed inline. This tool also provides a feature of customizing the text and style based on the class. The interesting feature of this tool is that one can attach comments to a CRC card and also link the comments along with the comments. One can also attach a Diagram Description to a card.&lt;br /&gt;
&lt;br /&gt;
[[file:438px-SWIdeasModeler.png|center|x300px|SWIdeasModeler Tool]]‎&lt;br /&gt;
&lt;br /&gt;
There is an export to raster image formats (BMP, GIF, JPG, PNG, TIFF), vector image formats (Windows Metafile, SVG) and PDF. There is also export to XML. There is an import from XML.[http://en.wikipedia.org/wiki/Software_Ideas_Modeler Software Ideas Modeler - Wikipedia] It also provides support for various languages. The application supports also style sets for the whole project. The diagrams can be exported to multiple image formats and vector formats like WMF, EMF, SVG and bitmap format PNG.&lt;br /&gt;
&lt;br /&gt;
On the core ideas of CRC card use, namely in specifying classes, responsibilities, and collaborators, SIM was very effective. The user interface was rather intuitive, and adding and removing entries was handled through a simple property page. Software Ideas Modeler enhanced the CRC card functionality by allowing entry of subclass and superclass information, which may or may not be &amp;quot;too much&amp;quot; information depending on one's opinion on the required elements of a CRC card.&lt;br /&gt;
&lt;br /&gt;
== Visual Paradigm for UML ==&lt;br /&gt;
&lt;br /&gt;
A CASE tool for UML diagrams is Visual Paradigm for UML . It supports thirteen types of diagrams.Type of diagram can be selected from Diagram navigator. The option to select CRC card diagram is found under requirements capturing tab.Selecting a new CRC card diagram opens up a new diagram toolbar. We can create cards by selecting CRC Card from diagram tool. A new CRC card appears on screen. The properties have to be edited. We can edit Card name (class name), Super classes, sub classes, its attributes, its responsibilities and its collaborators. Attributes and responsibilities may be added by right clicking on attributes or responsibilities heading and click on add attribute or responsibility. Name of attribute and description can be entered and while entering responsibility Name and its collaborator are entered.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[File:File-Crc-visual.png|x300px]]&lt;br /&gt;
|[[File:File-Edit description.png|x300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Class-Responsibility Collaborator (CRC) card is designed for identifying classes and operations in object-oriented approach. Visual Paradigm for UML provides a CRC Card diagram for software team to brainstorm, records, analyze and maintain CRC cards in systematic and collaborative way. This tool is very easy to use and intuitive. It allows easy addition of responsibilities to a class. Along with this, all fields on a crd can be edited inline. Visual paradigm is a simple diagram tool.&lt;br /&gt;
&lt;br /&gt;
Other than providing the common CRC-related functionalities, it has the following peculiarities:&lt;br /&gt;
* Record audio to associate to a diagram.&lt;br /&gt;
* Decide which portions of a CRC card are displayed (Responsibilities, Attributes etc.)&lt;br /&gt;
* Directly generating java code in eclipse with the class diagram.&lt;br /&gt;
* All properties in a CRC card must be edited inline. To edit, double click on the desired field, update its value, and click on the diagram background to confirm editing. (from here)&lt;br /&gt;
* It can generate UML class diagrams automatically out of the CRD cards.&lt;br /&gt;
* Cannot drag and drop values from one card to the other.&lt;br /&gt;
&lt;br /&gt;
= Comparison and Trade Off between tools =&lt;br /&gt;
&lt;br /&gt;
Most of the tools that we have discussed so far, provide the ability to record on each card the name, the responsibilities, and the collaborators of an object or class. Considering these and some main features, we can compare them as the below table suggests:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto&amp;quot;&lt;br /&gt;
|+ '''Tools feature comparison'''&lt;br /&gt;
! Feature || QuickCRC || VP UML || SIM || HD || Stickies&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Model scenarios || ✔ || || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Drag values from card to card || ✔ || || || ✔ || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate UML class diagrams  || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Handle subdiagrams || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Generate Java code ||  || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Collapse/expand cards || ✔ ||  || ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Display/hide parts of a card ||  || ✔ || ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Export/import card diagrams to/from text files || ✔ || ✔ || ✔ || ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Arrange cards based on different criteria || ✔ ||  || ✔ ||  || ✔&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Analyze text to extract classes, responsibilities and attributes || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| Reverse engineer existing source code || ✔ || ✔ || ✔ ||  ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Conclusion =&lt;br /&gt;
&lt;br /&gt;
CRC modeling is a very effective technique for identifying and validating user requirements. It works hand in hand with use cases and prototypes, and leads directly into class modeling. Using CRC cards, one can speculate the various possible designs, ensure that they are concrete and establish an explicit relationship between objects. This makes it easier to understand, evaluate, and modify a design. &lt;br /&gt;
&lt;br /&gt;
One of the major problem for using this is the integration of the cards with larger and more complex design methodologies and with particular language environments. The need to retain the value of physical interaction points to the need for a new kind of user interface and programming environment as far beyond what we have today as our current systems are beyond the tool-oriented environments of the past.&lt;/div&gt;</summary>
		<author><name>Smahish</name></author>
	</entry>
</feed>