CSC/ECE 517 Fall 2010/ch3 3f lj: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
'''Singleton Pattern in Static and Dynamic languages'''
'''Singleton Pattern in Static and Dynamic languages'''


=Singleton pattern=
A singleton pattern is a design pattern that restricts the amount of instantiations of a class to one object.  This pattern is implemented when exactly one object is needed to coordinate actions across the entire system.  The restriction of only having one object can sometimes make the system more efficient and allow the programmer to exercise more control over certain actions in the system.  A singleton must satisfy some global access principles, which say all of the classes must be able to access the functionality contained in the singleton class/es.   
A singleton pattern is a design pattern that restricts the amount of instantiations of a class to one object.  This pattern is implemented when exactly one object is needed to coordinate actions across the entire system.  The restriction of only having one object can sometimes make the system more efficient and allow the programmer to exercise more control over certain actions in the system.  A singleton must satisfy some global access principles, which say all of the classes must be able to access the functionality contained in the singleton class/es.   
=Singleton pattern=


=Implementation=
=Implementation=

Revision as of 03:39, 6 October 2010

Singleton Pattern in Static and Dynamic languages

Singleton pattern

A singleton pattern is a design pattern that restricts the amount of instantiations of a class to one object. This pattern is implemented when exactly one object is needed to coordinate actions across the entire system. The restriction of only having one object can sometimes make the system more efficient and allow the programmer to exercise more control over certain actions in the system. A singleton must satisfy some global access principles, which say all of the classes must be able to access the functionality contained in the singleton class/es.

Implementation

When this pattern is implemented then it must only have one instantiation of a class and that class must satisfy the global access principles.

In Dynamic languages

In static languages