Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,128 | Comments: 45,549

filter by tags archive

If Program I Can't, Programmer Am I?

time to read 3 min | 497 words

Jeff Atwood has posted about the difficulities of some so-called programmers to program. The intersting facts are here. An extremely simple task is given, and quite a bit of people simply can't handle it, or take an undue amount of time to solve it.

A while ago I posted all sort of interesting questions that I would not put in interviews, it was the sort of interview questions from hell. I did a lot of interviews since then, and I have gotten sick of the level of people that I meet.

My current favoriate question is to give them this code:

public class Program
   public static void Main(string[] args)
    //print the input string in reverse

And ask them to solve it. It has gotten to the point that this is literally the first thing that I would ask a candidate to do. I am not picky, I would accept a solution in any imperative langauge except Ook#. And quite a bit of them simply can't do it. I am usually interviewing people that are supposed to have two years or more of experiance building applications in .Net. And they simply can't do it.

Let me tell you how vicious how I am with this horrible question, I give them a laptop (mine, actually) loaded with Visual Studio + ReSharper, full access to the net (and yes, that include Google), and they still can't do it. In one particular case, I watch the candidate go to google, skip the first result that was titled "Reversing a String in C#" and go directly to a code sample in C(!). He then spent the next five minutes shocking me by trying to get it to compile.

I can think of at least five different ways of doing it, depending on whatever you know that string can be iterated or that it has an indexer. I would expect that even if you didn't know either about string, you would realize that you can use Substring() to do it in a horribly inefficent way.

I can accept people with lack of knowledge, I can accept newbies (no prejustice is good), but I can't accept someone who can't program.


shawn hinsey

That question is kind of confusing. Do you mean to print the contents of the args array in reverse, the contents of an arbitrary index of the args array in reverse, or maybe the contents of every index in the array in reverse?

Luke Breuer

@shawn: Confusing questions can be a good thing. Just as you picked up upon the ambiguity, so should an interviewee.

@Ayende: Where do you find these people? I'm not saying that I had a whole lot of faith in the human race already, but this is just disheartening. At least this gives me a competitive edge...

Ayende Rahien

Ah, you already got the first hurdle. I saw some people getting stack on THAT for a while.

The kept trying to reverse the string using the args variable.

I meant reversing the string in args[0].

Ayende Rahien


Where do I find this people?

Trying hiring people that directly from the market, (meaning not through friends and such).

Even when getting screened candidates, I run into those depressingly often.

Alex Henderson

Yeah, it's surprising how many coders still go to work to eat their lunch... surely there are other industries to get into (for more money) if your really not passionate about it?!!

string reversed = new string(((args ?? new string[] {""})[0] ?? "").Reverse().ToArray());

Ayende Rahien

Alex, I had to use brace matching to figure it out, but string doesn't have a Reverse() method on it.

Darius Damalakas

Last time i gave a candidate to write a Fibonacci queue.

It took him 15 minutes to write 5 simple statements, all of which where assignment. And then he started me exaplining the algorithm orally, drawing some things on the whiteboards and telling me that we need to use he some simple loop.

After i repeatedly asked him write down the solution, he gave up.

Alex Henderson

Sorry, the Reverse comes from System.Query as an Extension Method ;o) (because a string is IEnumerable)

It's a terrible terrible way to do it... I can only imagine the Reverse collects all characters internally as a stack and then feeds them back out again via a yield in reverse order (unless it's optimised for string types) - and then I imagine they probably get collected into yet another list before being converted into an array... lots of needless memory allocation.

Would need to fire up reflector and have a look to be sure of course.

Perhaps once LINQ is in the wild you'll start to have candidates who try it this way because "Reverse" shows up in intelisense for a string.... :P

Ayende Rahien

Cool information, when Linq will be out, it would be the time to the next challenge, capitalize every second character.


LOL, that remembers me on an interview I had back then (where I was the Interviewee) where I was asked how to swap the contents of two registers without allocating a third one for buffering. The interviewer mentioned, that it took him quite a while to figure out how to do that and somehow he didn't even expect me to answer.

When I came up with a solution he didn't believe me and tried arguing with me why my proposal won't work. Luckily I got support from a second guy attending the interview, though listening to his arguments a bit longer would definitely have been funny.

Oren Ellenbogen

Man, you are killing me :).

If she\he can't reverse a string or capialize every second character, she\he in the wrong business. This is a no-brainer question. We are dealing with much more complicated scenarios on a daily basis so if she\he can not give me an answer within 2 minutes and smile("is this question for real?! he's kidding.. right?) while they are writing it, I don't want her\him on my team.

Ayende Rahien

I wish I were kidding, I have met people that are supposed to be "veteran professionals" that can't do it. You can probably guess that they aren't on my team, nor employed at my company in any development capacity.

Bill Pierce

Was curious how M$ would reverse a string in .Net 1.1. This comes out of Microsoft.VisualBasic.Strings.StrReverse:

string reverseThis = "test";

char[] array = reverseThis.ToCharArray();


string reversed = new string(array);

Realize the goal is not to find out if the candidate knows how to reverse a string. I can't recall a business requirement in a system I have worked on that said we need to reverse the user's input. I would almost prefer that the candidate DID NOT know how to reverse a string so they can demonstrate their thought process for solving a problem.


You people are foolish if you think that such questions help you find skilled programmers or good thinkers

Look at some of the code they have written in the past. Discuss concepts. Dumb ass pop quizzes are useless and if the person is nervous, then you have lost a potentially valuable asset.

Ayende Rahien


No, these type of questions won't find good programmers.

They would find the really bad ones, and that is there purposes, to screen the ones that aren't really programmers from those that can make one end of the compiler from the other.

Frankly, I would have much harder time explaining abstract concepts than writing a bit of code to do such a simple task.


Could I use Rebol language?:

reversed-string: head reverse string-to-reverse

or if I don't want to modify original:

reversed-string: head reverse copy string-to-reverse


Are you sure you are not interviewing Geography students by mistake?

It amuses me how some people get really touchy about asking programmers to program in an interview. Like you say the objective of the test is to pick out the bad ones, not the good. Anyone can lie on a CV.

Ayende Rahien

If only...

I would have more success with them, at least they would know a mountain from a chair

Comment preview

Comments have been closed on this topic.


  1. The worker pattern - 2 days from now

There are posts all the way to May 30, 2016


  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats