A company that I work with has asked me to do candidate phone screenings to make sure they aren't completely embarrassed when sending over someone to a potential client.

It turns out that a fair number of people were being placed for a C++ developer role. I don't spend much time in C++, but I have done a few trivial and non-trivial projects in the language. I figured that "Explain the RAII idiom" would be a nice softball question that most serious C++ developers could answer while half asleep, and would allow me to move on to more interesting questions about experience. But it turns out people who have 10+ years C++ experience don't recognize the term, even if I expand the acronym to "Resource Acquisition is Initialization." One candidate went so far as to say he felt it wasn't always practical to apply the technique in Windows development, which I thought was an odd sentiment, but I could see a couple of examples that arguably support that line of thought. (But really only arguably).

Even a couple of C++ developers I know well enough to judge their competence said they didn't recognize the term, but upon reading a summary of the technique, said "Oh, yeah, I didn't know that had a name. I just thought of those things as something you just have to do." I remember the term from the second edition of Stroustrup's book, even though the full impact didn't sink in at the time.

So, is "Can you explain the RAII idiom to me?" a fair screening question? Is it reasonable to expect all competent C++ developers to understand it? Is the term more esoteric than I would think? Assuming a candidate doesn't know the term, are there follow up questions that could help me tease out whether they have at least internalized the practices that make RAII work? Are there better alternative "weeder" questions that give the candidate some latitude in answering, and help the candidate demonstrate their understanding of C++ development?

Editing to add: To clarify, I'm not the sort of interviewer that disqualifies people because they don't know buzzwords and acronyms. However, I do think it's reasonable to expect that an experienced C++ programmer has internalized good practices for resource management. I also think that it's important to verify that a candidate understands some "basics" about the technology they claim expertise in before moving on to more interesting questions about design, problem solving, etc. I think what I'm looking for is a good way to ask an open-ended question, suitable for use in a short telephone screening, that I can use to judge a candidate's basic understanding of good resource management practices in C++, before I ask "hard" questions.

  • 3
    "Even a couple of C++ developers I know well enough to judge their competence said they didn't recognize the term". Okay. "So, is "Can you explain the RAII idiom to me?" a fair screening question?" Why ask? You couldn't find folks that knew about it. What more do you need to know that you don't already know? Perhaps you should downplay this subject (since you already know the answer) and focus on "Are there better alternative "weeder" questions" which might be interesting. Except that it's a shoot out opinions, which aren't tolerated well. – S.Lott Jun 7 '11 at 20:50
  • 9
    Idioms change, good practice doesn't. Instead of asking about a particular idiom, how about simply asking, "what steps do you take in designing a class to make sure it doesn't leak?" – Blrfl Jun 7 '11 at 20:58
  • Fair enough, although my sample size is low and I'm not actively engaged in the C++ community anymore, so I don't know what the community considers essential knowledge these days. I'm essentially trying to figure out how to expand my repertoire of questions that can be used to judge real C++ knowledge beyond, for example, the basics of syntax. – JasonTrue Jun 7 '11 at 20:59
  • 2
    your problem is not what I expected. I assumed you would find someone who knows what RAII is, gets hired, and only later do you find out they still suck at coding. – Kevin Jun 7 '11 at 21:15
  • 1
    @JasonTrue: I think fizz buzz questions are supposed to be actual programming questions like reversing a string. But anyway I think it's a fine question. You might also consider asking what features in c++-0x the interviewee thinks are most exciting or important. It's a bit harder but if you get a good answer it probably means good things. And the question can always fall back to, 'what boost libraries are most important/interesting' if you get a blank stare. – Kevin Jun 7 '11 at 22:34

You seem to have found that C++ developers you know from experience are competent are unfamiliar with that acronym or even the full expression. That alone would seem to indicate that the question is not suitable as a screening question during a phone call.

On the other hand, you could get to the same point via a more roundabout way by posing a scenario. Something like: "You are implementing a Log class that will write logging information to a file. Obviously, you will need to have a member variable that is a file handle (std::FILE*). Where do you allocate and free this file handle?" If the candidate starts talking about creating an open() and a close() method rather than allocating the file handle in the constructor and deallocating the handle in the destructor, you can follow up by asking about things like how their class would behave if the calling code raised exceptions, etc.

| improve this answer | |
  • An excellent suggestion. I like this approach. – JasonTrue Jun 7 '11 at 21:04
  • Takes too much time in a phone interview. – HelloWorld Sep 19 '16 at 4:09

I don't think it is a practical question as it is proposed. I think you will find a lot of developers will fall into the "oh, yeah, I didn't know that had a name" camp. I would suggest that you test the candidates on the concept and not the name of the concept. Give them a code example and ask why it is incomplete or have them demonstrate that they know the concept.

| improve this answer | |

I do think is a valid question. Although I don't know how popular is the RAII term (in my team, we do use the term RAII all the time) but the concept of resource handling is important especially if you want exception-safe and multi-threaded-safety as well.

| improve this answer | |

Well, I know that when I want to know if someone is competent, the first thing I do is check their knowledge of acronyms. Once that's established, I make sure they know the names of other technologies that I think sound cool. If they're still there after that, then I ask them for a list of their favorite colors.

I can't stand this sort of thing. I mean, on my end of the interview, this is sirens and warning bells. I don't want to be working in a place where it actually matters that I know bizarre mnemonics that my boss thinks are "fundamental". I can't be bothered to learn peoples names who I've dealt with for years, so I sure as hell don't waste brain space with cute acronyms that describe best practices.

Look at my code. Ask me how I'd do things. I'll doodle crap on a whiteboard until the cows come home. I'll code you an app. Don't give me bullshit trivia questions. Trivia is always hit or miss, and it's never fundamental.

| improve this answer | |
  • I don't tend to ask a lot of esoteric knowledge questions in screening interviews, but there's a bit of due diligence I'm expected to do to make sure someone's not completely incompetent. Accordingly, I'm looking for an open-ended question that allows me to verify some level of knowledge while allowing the candidate to show off their own background. I expect "some" straight up knowledge if someone says they know technology X on their resume; my question boils down to, what knowledge should I expect of a C++ programmer that's an useful gateway to further conversation? – JasonTrue Jun 7 '11 at 21:07
  • 4
    @jason: Well, I'll probably be able to remember the RAII acronym for a few months. Does that ephemeral knowledge make me competent, even though I haven't touched C++ in years? It's pithy trivia. Ask them how they handle locks, and make sure they understand the actual KNOWLEDGE, not the weird acronym. – Satanicpuppy Jun 7 '11 at 21:22
  • 1
    @jason: I agree. I just don't agree that the basics include this sort of trivia. An idiot might know it, and an expert might not. You're basing your selection process on something irrelevant to skill. – Satanicpuppy Jun 7 '11 at 21:40
  • 5
    Knowing what RAII is called is not essential knowledge. But automatically reaching for the pattern is. – btilly Jun 8 '11 at 1:44
  • 2
    RAII is a foundational concept of good C++, and the term has been around for at least 20 years. I think that dismissing it as trivia is somewhat unfair. While you can have good C++ developers who don't know the term, for me it smells of someone who does not research their craft. – Kaz Dragon Mar 25 '14 at 10:47

If your purpose is to screen out total incompetents quickly, try something like this:

FizzBuzz Test

Then you can leave C++ concepts and practices to those in a better position to evaluate C++ expertise.

| improve this answer | |
  • 1
    I've used, and received, this question frequently, and mentioned it above in my comment, but I find it awkward to ask in a 25 minute phone conversation. – JasonTrue Jun 7 '11 at 22:22

It's a valid question, but not for screening. I used it as a written question, to be discussed at interview. You can get a lot of insight into thinking patterns given advance notice. As a screening question it's just a nasty trap.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.