Simpleton pattern
Problem
We don’t want multiple objects of the same class, but we also don’t want to clutter our code with the kind of checks required to implement the Singleton pattern
Solution
Kill program execution if a second attempt to instantiate an object occurs
Example
class Foo {
function constructor(){
if(objectOfClassAlreadyExists('Foo')){
stopExecution();
}
...
}
}
...
variable foo = new Foo //all good
...
variable bar = new Foo //poof!