Why Can't Programmers.. Program?

I wonder why it is 199 out of 200 instead of more reasonable number like 99 out of 100? In any case I believe him. It is amazing how many people are paid to be programmers that struggle at the job and clearly should have been hired in the first place. When I used to teach college I noticed the same trend… a large number of CS student just really did not understand how to program. It was 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

Ofcourse we all know that being a elite programmer is all about how fast you can program, especially in a high-pressure situation.

Wow. Now that’s sad. I don’t call myself a programmer at all, and I could write a solution to this in Qbasic!

Most development is simple viewing and editing of data in forms.

Developers who can’t write “fizzbuzz” can be productive in such an environment, especially if there is existing code they can copy and modify.

Most development is simple viewing and editing of data in forms.

Developers who can’t write “fizzbuzz” can be productive in such an environment, especially if there is existing code they can copy and modify.

I suspect some of the people above complaining about the high pressure of having to write a ten line program including division may fall into this category. :slight_smile:

if program does require recursion, then definitely everyone will use this.

"Most development is simple viewing and editing of data in forms.

Developers who can’t write “fizzbuzz” can be productive in such an environment, especially if there is existing code they can copy and modify."

They’d also be an incredible liability. If fizzbuzz is beyond them, concepts such as memory/processor usage, security, stability, defensive programming, etc. are going to way out of their grasp. I’ve worked with someone like this; they cost us time, because everything they wrote had to be completely re-written by someone else. Unchecked inputs, error messages that consisted solely of dancing cats (seriously), SQL and HTML injection holes all over the place.

On writing a program to switch two variables without a temporary variable; while I had a hunch it involved bit operations of some kind, I certainly wouldn’t know how to do it off hand.

On time taken to program; I’d probably spend several minutes just staring the FizzBuzz task, looking for some complexity I’d missed, so that’s also something to take into account.

to LKM:
"Instead of using recursion, it’s often faster to use a Stack"
do you understand how, in almost any language, recursion involves a stack ? you are just making the hidden part visible…

to shiva:
"if program does require recursion, then definitely everyone will use this."
agreed, but you are free to think a bit longer and see if you cannot avoid it. this is the difference between a good programmer and a smart programmer: the former knows how to solve the problem while the later invents new ways to solve the problem more efficiently.

to Fabian:
no, you forgot a part of the requirements. wroooong ! do it again !

to Jeff:
"it’s amusing to me that any reference to a programming problem-- in this case, FizzBuzz-- immediately prompts developers to feverishly begin posting solutions."
it is also amusing how many of those solutions are wrong. so typical of our profession…

Back in '99, I was given a FizzBuzz task by a Microsoft recruiter to design a program that would take two inputs and determine if they were anagrams of each other. I began with a quick test of string length - if they didn’t have the same number of characters then it was immediately rejected. He was very impressed that I would start with such a test. Seems most people would go through cycles and cycles regardless of the inputs.

To be honest as a recent grad and somone who is new to being a software developer I think if you are incompetant you shouldn’t last long anyway.

In my first month at my new job I had to learn VB and C++ from scratch, two months later I was moved on to a project in C# using ASP.Net which I’d never used before. I’ve seen similar tests to the fizzbang questions, and they are useful.

My current employer gave me 3 hours to parse an XMl file and display it as a tree structure. I’d not spent much time playing with XML before but with after a quick google for a reference on the SAX api I was coding away. apparently half the candidates couldn’t write anything and others didn’t know how to use and IDE and insisted on using a text editor. which they screwed up.

Another couple of employers has written tests with small “write a code fragment to do this” and “spot the mistake in this code” questions. both were piss easy but there were some trick questions in there.

I think what should be tested especially for recent grads is not the knowledge per say, but the capacity to pick stuff up, I got my current Job becuase I took an API I had never used before and figured out how to use it. I’m by no means a pro, but I have the capacity to learn by myself, some people can’t pick up new things unless they are spoon fed.

University is not an excercise in cramming your head full of knowledge it’s an excercise in learning how to learn quickly and efficiently.

When you know the basics you can teach yourself a new language in a few hours, and depending on the complexity learn a new API in an hour to day. Many grads I find dont have that capacity, I did a masters with a bunch of people who came from different universities to me, and some of them just couldn’t cope with having to fend for them selves.

Thats my two cents anyway. I think the fizbang questions help sift out the muck but the problem is more intrinsic and needs to be addressed at the level of academic institutions.

Stu Thompson wrote, “There is a stunningly large population of people who describe themselves as ‘professional software developers’ who have not the faintest idea about recursion, bit masking, hexadecimal maths…or how to code a simple for loop that does something like FizzBuzz.”

FizzBuzz, sure, any programmer should know how to write that. Bit masking though? That example just goes to show the wide range of expertise involved in programming, not all of which is required to be a successful or skilled programmer.

I don’t think I’ve used bit masking (and I can’t even remember what it is, exactly) since college. But Stu goes on to say talk about asking for SQL examples in interviews, and here not only would I be able to demonstrate inserts and updates - of course - but left joins, cross joins, multi-table deletes, whatever.

FizzBuzz is an acceptable test because it is non-domain specific, the same cannot be said for all other types of programming knowledge.

Quote: Granted, the XOR trick is pretty well known, but not knowing it off the top of your head says nothing about your abilities as a programmer (whereas the fizzbuzz example does).

True. However, someone who’s never read enough professional literature (including programming blogs) to have seen this may either be:
a. very inexperienced OR
b. not interested in programming outside of coursework/their job.

I submit that such a person is never going to be a great programmer (although they may be, barely, adequate).

Common, unfortunately. The majority of CS grads can handle the trivial stuff like “FizzBuzz” (though a slight majority probably never really grokked recursion). But I’ve seen people hired at my last job who couldn’t code.

in one case, the person did know a bit of syntax, but they had absolutely no debugging skills. This person didn’t know the integrated debugger existed. They didn’t even use simple debugging outputs to the console. No, their method of debugging was to randomly change stuff to see if it fixed their problem. Not surprisingly, that didn’t work very well.

Fabian

Nice little snippet there. However, it doesnt fulfill the specification.

“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”.”

You arent writing out i when its not %3 and/or %5

Close but no cigar.

I need a raise then, cause I actually write and ship a COTS version of the FizzBuzz application.

"it is also amusing how many of those solutions are wrong. so typical of our profession…:

I noticed this as well. Makes one really start to question the worth of such statements as “if you’re reading this blog, you’re already much better than those other programmers”.

I remember at my first University course the teacher asking how many people never programmed before. Many hands were raised, and I felt bad for them for choosing a future profession without knowning what it actually was about. Then he asked how many people never touched a keyboard before. How shock was I to see at least 10 persons raise their hand, mostly women.

I’ve witnessed the same, sad truth. It even inspired me to write my first blog entry on candidates attempts to code strcpy():
http://davidavraamides.net/blog/2005/05/07/strcpy/

I think the takeaway from this is that you are a fool if you are interviewing programmers and not requiring them to write some code.

Toepopper: swapping variables without a temp is more what I’d call tech trivia then useful knowledge. There really isn’t a good use case for it anymore (its not even necessarily faster than using a temp since procs have so many registers these days). Besides, your solution of a=a+b, b=a-b, a=a-b fails in overflow cases. The candidate’s XOR solution is more correct, but still unnecessary.

rien: you are right on regarding understanding recursion. I agree that its frequently not necessary and often the less efficient solution, but being able to recognize that fact, and to read someone else’s code, requires familiarity with the technique. And that’s why I would consider it fair game in an interview.

“we all know that being a elite programmer is all about how fast you can program, especially in a high-pressure situation.” …well, yes, if you’ve got an online application and somebody’s just discovered a serious bug, sometimes that’s exactly what it’s about.

Recursion? I never used to use it either. Then I read the first chapter of Structure and Interpretation of Computer Programs, and some other stuff about writing compilers and interpreters. Now I use recursion all the time, coming up with all sorts of general, automated solutions for the sorts of tedious tasks I used to code out by hand.

Why can’t they program? Because demand for good programmers has outstripped supply. Those of us who interview a lot of applicants (I’ve seen at least 50 the last year) know two things: most can’t program, and those who can will be tough to get. And now it’s been bad enough for long enough that many doing the hiring can’t program either, so screening is often incompetent and these charlatans stand an excellent chance of getting hired anyway.

Testing is imperative, but some just seem reluctant to do it – it seems so cold and mean.

Fizzbuzz looks like a good test. Here are two other standard questions, the first one broadly published and the second very general. Many “programmers” flop on one or both:

  1. Draw four “cards”, showing “A”, “B”, “2” and “3” respectively. Say that for each card there is a letter on one side and a number on the other side. I have a theory that if there is a vowel on one side of a card, then there will be an even number on the other side. Which cards do we need to turn over and examine the other side of to adequately test my theory?

  2. What is a hash table, and when would you use one? Why might you prefer using a hash to using an unsorted array, or a sorted array? What tradeoffs are you making when you choose between a hash and a sorted array?

When the applicant doesn’t know what a vowel is, or a hash table is, I know it’s going to be a long day…