My favorite pattern
A while back, complaining about the horrible state of technical interviews, someone commented that he was asked what his favorite pattern was and he smuggly said pastel. Well, I would like to state for anyone that interviews me now or in the future for any job, that my absolute favorite pattern is the singleton.

It just looks erotic in UML.
NOTE: I generated this tonight to teach a friend about caching context lookups in his code. I generated it using IntelliJ’s excellent bare-bones SimpleUML plug-in. It doesn’t do anything else, but for quick looks at how you’re doing it’s great for small projects. It’s UMLish, certainly not UML2.

December 31st, 2005 at 4:38 am
I like the visitor pattern. Very sexy, rarely used.
December 31st, 2005 at 11:39 am
For some views in the other direction, see http://blogs.msdn.com/scottdensmore/archive/2004/05/25/140827.aspx and http://c2.com/cgi/wiki?SingletonsAreEvil.
Cheers,
Laird
December 31st, 2005 at 2:02 pm
Yes..yes… the global variable issue. If it were used for anything other than a caching mechanism I would agree. However, looking at the alternatives for this application, I’ll accept the Faustian bargin.
December 31st, 2005 at 2:05 pm
Oh, I mean the Goethe’s Faust in the 1800s where he is saved at the end, not Marlowe’s Faustus in the 1600s play where he is damned. Although with singletons it could go either way…
December 31st, 2005 at 10:51 pm
nooooooooooooooooooo… singleton is the worst pattern on the planet. look at dependency injection and pretend that singleton was like that vd you picked up in college and don’t ever tell anyone about any more.
January 1st, 2006 at 2:18 am
I think dependency injection was a little above and beyond what my friend was looking for at that moment
January 13th, 2006 at 2:33 pm
[...] This could mean more than just a replacement of course, but an eventual adoption and approval by the JCP. Just like Hibernate and Spring did to EJB persistence and Dependency Injection (killing my favorite asexual pattern, the Singleton), even a change in mind-set or “what is possible” could impact the next round of JCP submissions. In fact, This may already be happening as we speak. [...]