Programmers that… can’t program.

So, I happened across this post about hiring programmers, which references two other posts about hiring programmers. There seems to be a demand for blog posts about hiring programmers, but that’s not why I’m writing this. I’m writing because there was this sort of nagging irony that I couldn’t help but stumble upon.

In a blog post, Joel Spolsky talks about the mathematical inaccuracies associated with claims of “only hiring the top 1%”. It seemed pretty obvious to me that whether or not you’re hiring the top 1% of all programmers is pretty much unknowable, and when managers say they hire “the top 1%”, I assume they’re talking about the top 1% of their applicants. Note too that I always thought it was idiotic to point this out, because, well, isn’t that what you’re SUPPOSED to do? You’re not very well going to aim for the middle & hope for the best are you?

Apparently I’ve been giving too much credit to management. There I go giving people with ties on the benefit of the doubt again.

Then, in another blog post, Jeff Atwood talks about how it’s very difficult to even get interviews with programmers who can actually program. The problem is real.

The original blog post that pointed me at the two others is one by Roberto Alsina where he talks about his own methods for weeding out the non-programmers. He’s clearly seen the issue as well.

But if you open all three of these posts in separate tabs and read them, you’re likely to come away with the same basic problem I did:

  • Who the hell are these managers who can’t figure out a dead simple statistics problem?
  • How can a person fairly inept at simple math be qualified to make a hiring decision for anything but a summer intern?

That sorta blew my mind a little. But it blew my mind a lot when Atwood started describing the problems that interviewees *couldn’t* perform in an interview! One task described by Imran was called a ‘FizzBuzz’ question. Here’s one such question:

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Here’s the part that blew my mind: He says, and I quote:

Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes.

Want to know something scary ? – the majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

That’s amazing to me. I decided to quickly pop open a Python prompt and see if I could do it:

>>> for i in range(1,101):
...     if (i % 3 == 0) and (i % 5 == 0):
...             print i,'FizzBuzz'
...     elif i % 3 == 0:
...             print i, 'Fizz'
...     elif i % 5 == 0:
...             print i, 'Buzz'
...     else:
...             print i

Note that I’ve taken the liberty of printing out the numbers in addition to the required words. I’m playing the role of interviewer and interviewee here, and wanted to be able to easily verify that things were correct, since there was no time for unit testing 🙂

Turns out it worked on the first try! That was pasted directly from my terminal screen. I didn’t time myself, but it took far less than 5 minutes. This leads to my other question, of course, which is “if you’re going to complain about CS degree holders not writing good code, maybe it’s time to open the doors to non-CS degree holders?”

  • rpetre

    To play a bit the Devil’s Advocate, your is not really according to spec (“print… instead of the number”) 🙂

    But yeah, it’s depressing to know it’s _that_ easy to make it in the “top 1%” and that a CS degree is often a substitute for skills for a lot of interviewers.

  • Joel

    I’m not familiar with python so feel free to correct me;
    Wouldn’t this be more efficient

    >>> for i in range(1,101):
    … if (i % 3 != 0) and (i % 5 != 0):
    … print i
    … if i % 3 == 0:
    … print ‘Fizz’
    … if i % 5 == 0:
    … print ‘Buzz’

  • Stan

    Not to be an annoying nitpick, but the problem statement says to print ‘Fizz’ *instead* of the number, rather than along with the number. (Presumably this also applies to the other two cases, but the language is not totally explicit on this point.) 🙂

  • JohnMc

    I was piqued once about our programming staff. So I sent out an email to a bunch of them who were on a mailing list. The results —

    * CS Majors
    * Musical arts
    * Self Taught, no degree
    * Business

    About that frequency. Some of the better work came from the music majors. Must wire the brain some how.

  • Brian Harring

    In my experience, most decent companies don’t give a damn about a CS degree in terms of hiring- when I’ve encountered those that do, that’s typically been a sign the place wasn’t a good environment.

  • David Gowers

    The problem is described in a way that makes it sound more complicated than it actually is.
    When I first read that, I wrote something very similar to the code you show above.

    But it can actually be simpler:

    for i in range (1, 100+1):
    buf = ”
    if (i % 3) == 0:
    buf+= ‘Fizz’
    if (i % 5) == 0:
    buf+= ‘Buzz’
    if len(buf) == 0:
    print (i)
    print (buf)

    The fact that your program does NOT conform to the specification* illustrates the misleading language used.

    * print i, ‘Buzz’
    and the like are wrong. The specification says ‘*instead* of the number’

  • James

    Very scary, but think of the pressure of the interview. Granted, it’s basic math, however one thing that holds true for me (and others I presume) is the issue of getting started coding. Once I’m going, I’m good, but in an environment where you’re being poked, prodded and judged, there’s some ‘stage fright’. Some candidates might over think the problem too. The old, “it can’t be that easy. This is an interview…”.

    That aside, it *is* a pretty straightforward problem. When I interview devs I usually hit them with standard stuff (SQL joins, iteration patterns, syntax) and throw in something obscure like a complicated regex or ask them to explain the importance of standard deviation of a population vs the average to see how they react. The obscure item is more to see how they handle it. Will they give up immediately, admitting they can’t do it? (Honesty goes far in my book. I don’t expect you to keep everything in your head; you’re going to need to look stuff up.) Will they fake through it and give me a BS answer? Or, will they solve it? 1 and 3 stay on the list, 2 falls off.

    Development skills shouldn’t be the only deciding factor in an interview either. Is the person excited about development? Are they a self starter? Mentorable? (I realize I’m stretching the boundaries of the English language with that last one…)

    Of course, interview tactics depend highly on the position to be filled and the culture of the company. One of the best interviews I was on consisted of about 20 minutes of discussion, followed by 15 Perl/SQL problems, followed by another 20 minutes of discussion. It was a good experience, I learned some things, I made some points and it was a great ‘geeking out’ session.

    Being a non CS degree holder myself, I definitely think that the degree doesn’t guarantee that you can do the work. For my money, real world experience at any level trumps an undergrad CS degree.

    Good post!

  • Justyn


    I read the python tutorial a month ago, had to look up how to do a for loop (knew it was different than c-style, but couldn’t remember how), and still ended up with a solution in less than 5 minutes.

    I did accidentally use “Buss” instead of “Buzz” though.

  • Christopher Mahan

    Step 1: Ask them if they are a hacker.

    If they say no: end of interview.

    If they say yes, and caveat that “hacker” is different than “cracker”, and how the media has twisted the original meaning and all that, then proceed to step 2.

    If they say yes and proceed to tell you about what they’ve been hacking on lately, proceed to step 2.

    Step 2:
    Ask them to (or listen to them) talk about what they’ve been hacking on lately.

    Step 3:
    Figure out if you can use their brain. If so, make an employment offer. Integrating them into the organization is left as an exercise for the manager.

    If not, thank them for their time, explain that you don’t think it’s a good fit, because your organization is obviously not in a position to fully utilize them.

    Study the Way of the Carpenter. From Miyamoto Musashi’s Book of Five Rings. (Written in 1645): If you would be an effective manager of men.

  • Martin Vilcans

    Actually, your code doesn’t work. Read the spec: ““Fizz” *instead* of the number and for the multiples of five print “Buzz”.” (emphasis mine)

    I’m just teasing you, but it shows that even this simple test is not not as totally trivial as it may seem. I’d also say the spec is a bit unclear on what should be printed for multiples of five.

  • Roberto Alsina

    Sorry, your version of FizzBuzz doesn’t work (it’s brokwn in the same way as the one I posted in a comment in my blog): it has to print Fizz/Buzz/FizzBuzz **instead** of the number 🙂

  • Henrik Ravn

    Except that you didn’t solve the problem as stated. Hint: “instead of the number”

    Sorry, couldn’t resists 😉

  • Jeremy

    I’m afraid that you got the fizzbuzz wrong. You’re supposed to print “Fizz” *instead* of the number; not in addition to it.

  • Paddy3118

    Have you never been given an easy question when expecting something hard and wasted time looking for the non-existent catch?

    From your description, is the answer for the number 15 fizzbuzz or “fizz buzz fizzbuzz” or “buzz fizz fizzbuzz” or …

    I would think better of the applicant that asked such a question as it shows an analytical mind.

    – Paddy.

  • Alexander Dinu

    sorry for little offtopic addition, but “fuzzbuzz” and other must prints ~instead~ of the numbers) so your code is wrong 🙂

  • m0j0

    Yeah, should’ve known the parade of nit-pickers would be by, and they’re not wrong, my code spits out the numbers *in addition* to the required words. It was a conscious choice on my end, so that I could easily check my work, since I was playing the role of the interviewer *and* interviewee. It’s not like the time frame left time for unit tests or something.


    Even shorter:

    for i in xrange(1,20):
    print ((i%3==0 and ‘Fizz’ or ”)+(i%5==0 and ‘Buzz’ or ”)) or i


    Obviously the previous xrange call should be xrange(1,101), I just copied the test code I wrote 🙁

  • m0j0

    For the record, “short” is not a virtue. It’s a fun hobby to see how short you can make something, but if I came across that kind of code at work somebody would be getting a cluebrick thrown at them.

  • Stephan Deibel

    I used to ask people how they would go about counting occurrences of words in a 100MB text file and present them sorted with most common first. I wasn’t asking for code, or even an efficient way to do it, just a sketch of how to approach the problem as a one-time utility task. There are so many ways to do this that span various types of programming expertise that I thought it was a fair question, but many failed entirely to even have the slightest idea.

    My problem w/ the Fizz Buzz example is that half the time I can’t remember that % is the mod operator since I rarely use it. I could see people getting nervous and choking if they can’t remember %. As an interviewer, I’d at least like to be able to separate out syntactic knowledge (not very important, especially for rarely used things) from ability to craft a simple algorithm (very important).

    And yes, I’ve been programming for 30+ years and I still either need to look up what the mod operator is or rely on semi-magical muscle memory to produce it. If I think too hard about the syntax, I don’t know what it is but if I am working away at the algorithmic level it sometimes just comes out of my fingers.

  • j_king

    I have a hard time believing the Atwood article is anything short of hyperbole. Even Spolsky’s.

    I think geeks suffer from an idealism that probably stems from the natural tendency to seek rigor. So when they interview, if a candidate fails to meet their parameters they get tossed in the 99% pile. What a waste.

    In a job-hunting situation people are forced into self-aggrandizement. You’re trying to sell yourself and trade your time and experience for money. With all the competition out there and the positions that companies take when hiring people (an aggressive, “we only hire the top 1%” position), it’s no surprise to me that most applicants I’ve interviewed have padded their resumes. To me it seems perfectly natural.

    I try and make a real connection with each person I interview. I like to disarm them and put it out on the table — a few questions about pointer arithmetic and I know they don’t actually know C. That’s fine if I’m hiring for a web developer position. I skip algorithms and most theory; web development is not brain surgery and all the positions I’ve hired for it are entry level anyway. So I just focus on what’s important and try to get a feel for whether they would get along with the other co-workers and be capable of contributing something other than headaches to the company.

    It’s unreasonable to expect applicants to entry-level jobs to be top-class engineers and know everything you do. Even if it’s “just fizzbuzz.” Maybe they’ve just read up on the latest and greatest web framework and made a few websites on their own. How would they even be exposed to a simple program like fizzbuzz? Does it even matter if your business is building websites?

    You just have to be realistic. Top-class engineers don’t build web sites. They build air-traffic control systems, industrial robots, and send satellites into orbit. Building dynamic web sites is easy and getting easier all the time.

    Now I’m not discounting the problem all together: people are prone to self-aggrandizement in the job-seeking atmosphere companies are creating. After all, if you are just starting out, how cool would it be to work at some of the most visible companies on the web? The signal-to-noise ratio is undoubtedly high but I don’t see how adjusting your approach wouldn’t remove the problem all together.

    My tip? If they sound like they’re younger than thirty and list more than two or three languages, take a look at the pile of resumes you still have to go through. If it’s a lot, you might want to skip past them. I value honesty highly and tend to prefer resumes that fit on one page and list only the attributes and experience relevant directly to the position I’m hiring for. This usually eliminates 99% of the pile before I even make interviews.

  • Tom

    “but think of the pressure of the interview.”
    And there’s no pressure in being given something that affects the lives of thousands of people or more? Or a project that will either save or cost the company the better part of a million dollars?
    Pressure, shmessure.
    If someone can’t listen to a (business) problem while under (deadline or interview) pressure and have a meaninful (whiteboard/paper napkin/elevator) discussion about said problem, do you really, REALLY want them on your team?

    Most of what a developer DOES is listen to business problems and deal with pressure and discuss and deliver solutions to said problems. If you can’t do a simple iteration with substitution on the fly, well, you’re probably better off going into academia. I kid, but professional development may not be for you.

  • Steve

    The basic problem is the assumption of a degree equaling the ability to write decent code. At the very least, it’s an indictment of the kinds of graduates the average institution pumps out, but I think it might be more basic: a CS degree is *theory*. Even with all the coding I had to do as an undergrad (over a decade ago, and in another country, I would add), I *never* thought for a minute that I could just go out with my degree in-hand and be a programmer (nor did I want to, but that’s another story). If people really want to solve this problem, make the profession of programmer one that requires a certification based on a set of standards.

    Debate over the formation of said standards in 3…2…1…(but at least it abstracts the problem from the CS domain.)

  • Seb

    “if you’re going to complain about CS degree holders not writing good code, maybe it’s time to open the doors to non-CS degree holders?”

    The shop I work at does. We’ve got 13 devs, and at least 5 of them don’t have CS degrees. One (me) has a 2 year degree in software dev from a community college, one has a masters in math, one anthropology, one aersospace engeneering, one game development… I think you see the trend, but I’ll point out they ALL involve abstract numerical analysis.