This post originated from an RSS feed registered with Agile Buzz
by Kevin Rutherford.
Original Post: mocking a singleton
Feed Title: silk and spinach
Feed URL: http://silkandspinach.net/blog/index.xml
Feed Description: kevin rutherford on agile software development and life in macclesfield
"To begin with, singleton's are all alone in the world; don't be afraid to point this out. Also, most singletons are created, get this, not even in a factory, but merely in a factory method. Finally there is the point that they are little more than dressed-up globals, and IME experience cause more heartache than they're worth. You can point to the many nasty screeds about singletons there are out on the net. All in all, mocking it shouldn't be too hard. A word: if your singleton has unusually large body parts, stoop to insulting that. Sometimes, to be kind, you have to be cruel."
The humour arises mostly from the pun on 'mock', of course, but also partly from deconstruction of the term 'singleton'. I find it fascinating just how quickly and completely a metaphor such as this can come to be adopted as primary language. To the extent that we get a small shock when someone reminds us where the term originally came from.
Many of the GoF design patterns have names that are metaphors (Bridge, Factory, Singleton, etc) and I think that's an important factor in their success. A few lines of code in some software aren't really a Factory; but the name evokes so many connections with the real world counterpart that we can quickly understand what those lines of code do (or were intended to do). We've stolen a word form another domain, so that the baggage it brings along will help us understand something new and more abstract.
Our industry is riddled with metaphors: windows, mouse, boot-strap, object, broker, layers. They help us bring our real-world, tangible experiences to bear on complex, abstract subjects. It would be hard to imagine life without them.
Look out for my conference workshops on the power and use of metaphors later this year. In the meantime, what has been the most useful metaphor you've encountered in software development? Which metaphors are the most surprising? Which are the most deeply ingrained?