Monday, April 04, 2011

Kent Beck on Singletons

Test Driven Development: By ExampleThis is an excerpt from Test-Driven Development By Example, the book by Kent Beck which introduced a first formalized version of TDD to the world.
Singleton is cited as one of the most famous design patterns, along with Null Object and Composite:
How do you provide global variables in languages without global variables? Don't. Your programs will thank you for taking the time to think about design instead. 
That's it, that's the whole Singleton chapter. First printing: October 2002.

There's also a more recent (re)tweet:
RT @: Someone (who?) gave me a good pattern tip at : don't say "singleton", say "globalton" instead. Nice one!

@natpryce is one of the two authors of Growing Object-Oriented Software, guided by tests.


Anonymous said...

Or some say it's an anti-pattern.

Unknown said...

Thank you for awesome post..its really helps me a lot, because it adds fuel to my determination.