SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 42 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"


A singleton pattern is used to allow the creation of only a single object of a specific
class. This is achieved by making the constructor private or protected and using a
static method to instantiate the class. In versions of PHP prior to version 5, we are
unable to enforce this restriction.
Many of the Joomla! classes use a pseudo-singleton pattern to allow us to instantiate
and access objects. To achieve this, Joomla! often uses a static method called
getInstance(); in some cases JFactory acts as a pass through for this method.
Classes that implement this method are not always intended to be singleton classes.
We can think of them as being a hierarchy in how we instantiate objects. We should
use these methods in order of priority: JFactory method, getInstance() method,
normal constructor (new).
If you're unsure how a specific class implements a getInstance()
method, you should check the official API reference at
http://api.joomla.org. getInstance() and JFactory methods
always return references; always use the =& assignment operator to
prevent copying of objects.


Pages:
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6