[rspec-users] Singleton classes

Ashley Moran ashley.moran at patchspace.co.uk
Tue Jan 19 10:13:40 EST 2010

On Jan 19, 2010, at 2:33 pm, Juanma Cervera wrote:

> Yes, I mean the Singleton Pattern.
> I am not an expert with OO, but I supposed this pattern was what best 
> fits my needs of a class that represent a unique resource in the system, 
> in this case it's something like a queue of jobs that I have to 
> administrate in real time.
> Am I right?

What would be the implications of *not* using a singleton?  Bear in mind that if you're writing a webapp, you will at some point have two of these objects simultaneously in different processes.

What is the responsibility of the object itself, and where does the responsibility for enforcing that the resource is only used by one client at a time live?



More information about the rspec-users mailing list