Why Can't Programmers.. Program?

Hrmf!

I wouldn’t hire any of you guys who sent in the Fizz/Bang program. You should have declared 5 and 3 constants, and used the constants in your code.

Besides, real programmers wouldn’t program in VB, they’d use Perl. Now, if I can only get this page to work in my Lynx web browser.

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

Ugh, had one of those on Friday. Our caching system was spitting out the wrong data (by which I mean, the wrong user’s data). Never showed up on the dev system because the caching system uses SoftReferences to allow the Java garbage collector to expire data from it, and the dev version never ran long enough for garbage collection to really be an issue. Important lesson about being really sure about your compareTo() methods before using java.util.TreeMap.

Took us 40 minutes to locate, fix, and patch to live. Which is a little longer than usual, but locating the problem more or less came down to eliminating everything it couldn’t be, then figuring out how it was the fault of what was left.

Geez guys - EVERY ONE of you who gave example code - EVERY ONE - hard coded the FIZZ and BUZZ conditions… And a LOT of you wrote code that will do the FIZZ, BUZZ and FIZZBUZZ but NOT print the integer…

My biggest problem with solving simple programming problems tends to be the memorization involved with different languages, especially if I haven’t used a particular language in a while. More often than not I’ll go through my resume and remove (or limit mention of) languages that I used for only a short time or simply haven’t used in a while.

For example, I feel quite competant with dealing with basic database issues, but without having touched a database in a few years I’d have to look up even the most basic sql statements, so I wouldn’t claim to be a capable database programmer, though after a couple of weeks I could be at least a moderately good one.

Recursion is a similar problem with different languages. Some languages don’t allow it at all, and others have very specific restrictions that make it a little harder to just jump in and say we’ll just make this call here and make sure the conditions are in line to stop the whole mess from self-destructing.

In other words, I have a terrible memory, but I can still answer most of those questions with whatever language I’ve been using recently. I simply have to maintain my resume to avoid being asked questions that would send me to the books (or the web) to find an answer that should just spring to mind immediately.

“And did you really think you could say “only 0.5% of programmers can write FizzBuzz” without people showing you how they do it? :P”

Gareth: my guess is the ones who couldn’t do it didn’t bother to answer

Anecdotal “evidence” against this: When I started my first job after university (also, my first programming job), I could /maybe/ have answered FizzBuzz in Java. I’d programmed probably less than 1000 lines my whole life. Two months later I was improving my colleagues’ code in a language I’d never used before. 2.5 years, some 36,000 lines of production code, and a good recommendation letter later, I’m stuck in a job market that only wants people with 5 years experience.

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

So you think that, even in an interview, it’s alright for an experienced professional to take 10-15 minutes to write FizzBuzz? That’s more than one minute per line!

do you understand how, in almost any language,
recursion involves a stack ? you are just making
the hidden part visible…

Do you understand that by using a local stack instead of the call stack, the computer needs to keep track of much less information and needs to do much less work building and tearing down the call stack? In most languages, using a stack instead of recursion speeds up your app tremendously.

Also, why the hostility? Did I somehow insult you? If so, I apologize, but I fail to see what exactly I did to you.

Any question can be made difficult. If asked an easy question, an interviewee knows they have to get it right and will become more nervous as time goes on. Over the course of three minutes, it can get very bad.

“Write a program that prints the numbers from 1 to 100.”

Inclusive/exclusive? Are we in a language in which fencepost errors are likely?

“But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”.”

On the same line or different lines?

“For numbers which are multiples of both three and five print “FizzBuzz”.”

What about performance? The interviewee may be trying to remember how mod is implemented. And thinking about fence posts. And thinking about 3 cases of control flow. And “fizzbuzz”. And working quickly. And acting calm. And why they’re being asked this stupid question. Normally you do not deal with all of these things at the same time, but asking a simple question in a stressful environment in which the interviewee is getting ready to put 110% in to whatever you say will likely lead them in to trying to do so. There’s only so much you can keep in your head, and even less when you’re nervous. As you get more nervous (because the question is taking a long time), your nervousness will feed into itself.

Whenever I’m asked a question like that, I think the manager is clueless, both technically and in their ability to lead a team. Asking insightful questions about harder projects will reveal who did the work, and asking questions appropriate to the applicant will show you understand your team. This just shows you’re a delusional asshole.

One company I know required applicants to do an almost code homework assignment before applying. A code sample or two as well as discussions of past projects should suffice and probably bring up good topics, as the subject will reveal what they’re interested in. If you’re a coder on the same project, ask for their solutions to problems you’re having.

I stopped explicitly listing my technical skills recently and just put projects I have worked on - that also cut back on the bullshit questions people asked. When not given something distracting like that, interviewers have to think about better topics - and the interview may even become a fun conversation at that point.

It requires a huge deal of self-confidence to be as much effective during an interview as during your lazy sundays. Most of us will think twice before considering writing the simplest statement in front of an interview panel. I agree with most of this article - but it should really insist of the psychological factors (Of course, you could argue whether good programming abilities are dissociable or not from good social and communication abilities).

Mike Reiland: when you wrote

“Not being able to answer that particular question certainly doesn’t preclude someone from being a good programmer. That’d be like asking a C# programmer how to do modulo 16 using only a logical and. Why the hell would they need to know that, and how does that help you determine that they understand the ASP.Net framework, etc.?”

I think you missed the bloody point. There are plenty of people who “know the [fill in the blank] framework,” but can’t program worth a flying damn in a circus tent. I’ve worked with people who brought a Master’s Degree in Computer Science to the table, but couldn’t understand the concept of a state machine or even building flag values by accumulating bits. I showed a simple event-driven framework to one junior programmer and his response was “I wasn’t taught that method.” He didn’t ever appear to grasp that there was more to the world than was taught in his Computer Science classes, and that we were allowed to actualy come up with and express ideas all on our own without a professor’s approval. Needless to say, he didn’t last long. (Actually, he was a little on the weird side; he kept coming to work after we fired him. That concept of being fired seemed beyond him as well.)

Check out http://worsethanfailure.com/Default.aspx for examples of people who “know the [f.i.t.b.] framework,” but can’t seem to express the simplest of concepts in code. It has little to do with hoop-jumping and clever tricks, and everything to do with getting the job done on a daily basis: some of these people come out of University with a degree and no idea at all how to code.

The company where I work has an extensive series of programming tests for potential new hires, including specific problems derived from the kind of coding we expect them to do on a daily basis. It’s amazing how many people can’t get through it. One applicant excused himself to go to the bathroom during the middle of the test, and never came back. It’s not even a hard test.

For the record: wrote the FizzBuzz thing in under two minutes–right the first time. (In all fairness, though, I first started programming when I was 15, and that was 31 years ago. If I can’t do FizzBuzz after that amount of time, I need to hang up the cape.)

I think it’s interesting to see how many people here are innately drawn to developing a solution to the problem, completely overlooking the original point (which was that many candidates wouldn’t normally find themselves innately drawn to this).

I think this defines one key aspect of programmers who succeed, and those who simply maintain as they move forward: an inherent interest in/drive toward practicing (in the Dave Thomas “Code Kata” sense) their craft, vs. someone who simply views programming as a job to complete.

In any field, there are those who are passionate about what they do, and there are those who do it because they need something to do; it’s just starting to catch up en masse with technology fields now. And it’s not necessarily a bad thing: you always need people who would rather do repetitive tasks, and you always need people who would rather be tackling ambiguously-defined problems, and these people are rarely one in the same.

And, just because I’m a geek, and can’t help myself, here’s what I whipped up in a couple of minutes. I’m sure it could be better, but that’s when you start up an interesting conversation about refactoring in the interview, right? :wink:

for i in range(1, 101):
x = ""
if i % 3 == 0:
x = x + "Fizz"
if i % 5 == 0:
x = x + "Buzz"
if x == “”:
x = str(i)
print x

Anyone who expects a VBA programmer to write “swap two variables without using a temp variable” code is going to end up hiring a programmer who gets bored in three months and leaves.

The FizzBuzz problem is a good example of taking a simple set of requirements and translating them into program code.

Unless you’re interviewing for an embedded software position, the “swap two variables with no temp” problem is a good example of utterly pointless “Let’s see if you know the same nifty trick I know” interviewing. You might as well ask the interviewee where they bury the survivors when a plane crashes on the border of Canada and the U.S.

Okay, so python’s required indenting and blogging don’t seem to go well together. Ah well, you all know what I meant. :wink:

I use recursion every day. It makes handling XML simple. I can’t imagine not using it. However, if I were hiring someone, I’d not make it a prerequisite. Neither would I fail them if they didn’t know what a modulo was. I’d be happy if they could solve FizzBuzz in 30 minutes. I’m more concerned that they understand a little about abstraction. If they don’t know what “this” is, then we’re screwed.

Opps… I suppose i should have a “return(0);” before that last curly bracket…

I guess that’s what I get for compiling without -Wall …

I think your man was just pointing out
that it’s a bit dodgy to say “use a
stack instead of recursion”.

Well, that’s not what I said. I said “Instead of using recursion, it’s often faster to use a Stack.” Which is true.

Recursion pretty much always uses a stack,

Yeah, but that does not change what I wrote. Coincidentially, I have written a Java-to-native compiler and happen to know how call stacks are implemented, and the overhead involved in building them up and tearing them down :slight_smile:

A simpler question, requiring NO answer: If you were writing a disk based index for fast access to usernames from id’s, what datastructure would you use?

Blank Stare = Fail.
Eyes light up with passion = Hire on the spot.

Note that the FizzBuzz Test requires at least some simple number theory thinking. Yes, some small children understand it, but most people with standard schooling are not comfortable with the ideas of multiples, common factors, modular arithmetic, etc.

I only point this out because 199 out of 200 should make us question ourselves about the test. I’ll accept that 90% of so-called programmers are “low functioning” but not 99.5%.

Is this FizzBuzz-style number theory knowledge required for programming? No. Does it help? Yes, a lot. I find applied mathematical knowledge to be a better indicator of quality, efficient, expandable programming than a checklist of fad languages and environments.

But, still, watch out for hiring only super-nerds or your product will be super clever but unusable by “normal” people. A little bit of variety of backgrounds helps.

“Beware of bugs in the above code. I have proven it correct; I have not actually tried it.” -Knuth