I have been recently assigned the task of taking interviews in my company. I have been taking interviews of developers and engineers with atleast 5-6 years of experience.
One of my favorite question is to ask whether they have used any kind of patterns...and the default answer has always been "Singleton Pattern"
Since it is the most simple pattern, I always end up asking them to write a code for it, and only 1-2 out of 5 end up getting it right, but get confused when I start asking about thread safety, double-checked locking issues and etc..
My questions are:
- Is it fair on my part to expect a person with 5-6+ years of experience to know how to write a Singleton pattern?
- Is it fair on my part to judge a person upon their ability to code a Singleton class?
EDIT: Some clarifications.
- When I ask if they know anything about design patterns, I would like to know what kind of GoF patterns they have used, why they have used and how they have used them. And with 5-6 years of development experience, I would expect a person to know about GoF patterns...correct?
- The first answer which everyone say when I ask about patterns is "I have used and written Singleton Classes". Singletons are at the cusp of being declared an anti-pattern...with asking them to write about it, I try to gauge 1. If they can code, 2. If they can code what they claim they could code, 3. Tell me the problems with Singleton...
Do I sound more reasonable now? :)