Why Can't Programmers.. Program?

Kris, you didn’t read the requirements, x is not printed if anything else is. Understand the requirements.

Why the hostility to these questions?

They are quite appropriate if you accept a variety of answers; I would take anything that showed the ability and inclination to think.

I would expect them to to get the Fizzbuzz problem logically correct, but not worry too much about syntactic details.

I would happily accept “Hmm. I’m not sure how to swap two integers in place, but I bet there is some sort of bitwise trickery that can be used”.

If I asked someone to write a recursive implementation of (say) the Fibonacci sequence, I would expect them to be able to pull it off-- but I would be overjoyed if they said “You know, this degenrates into a O(2^n) problem when implemented recursively due to recalculation. It would be better to implement it iteratively. Or if you insist on recursion, you could get O(n) time by using memoization”.

THAT is why you ask these questions. To find the people who can solve problems and propose solutions that you hadn’t foreseen. Sure, there is a place for code monkeys who can grab values from a form and stuff them in a database. But I will MAKE a place for a programmer with insight, problem solving skills and a genuine love of their craft.

I took me 4 minutes to write the working code in PL/SQL. But I am not a programmer, just a DBA.

I wanted to test myself to he how good or bad I am.

What do you have to be afraid of - failure?

Overall this doesn’t surprise me too much.

It’s amusing that various answers seem to indicate the writer didn’t actually read the question. Well, I assume that if you dare to comment with code you solved your understanding correctly, anyhow…

I’m not sure how fair the FizzBuzz test is, not because of the test, but because it is written. I always hated having to write code on exams (especially without scratch paper) because when you type code, as one always does, you can instantly spot spot mistakes, convoluted logic (I sometimes annoy friends by simplifying their logic into a fraction of its original size), easily redundant code (and unnecessary expensive instructions – don’t you know modulos are dozens of clocks, people?), you can restructure typed code, throw evaluations into or out of loops in seconds.

Not only that, you have brain left over to run all sorts of simple heuristic checks out, visual checks (I’m elsing that? duuuuh, get more coffee!) be it out of experience or a bordom of sorts.

But mostly there’s just the extra hurdle to paper. You are suddenly required to to keep several complete solutions in your head before you even put pen to paper. Because I have my pride - I’m not going to give you a stupid solution.

I much, much prefer even notepad to paper. I think many would agree, especially when he logic to be worked out involves several not-completely-trivivial bits. Fizzbuzz really only has one, some exclusiveness you need to consider.

Nick Franceschina, you rock dude. Made me laugh so hard :smiley:

Wow, Look at all the different languages people have used to do the Fizz Buzz and some have done it poorly. Does it still make them eligible for the job? And this is when the blog(post) by Jeff wasn’t even about writing the solution. :slight_smile:

I’m so amazed that graduates actually fail these miserable tests when the skill level required to hold a programming job is usually so beneath that of a compsci degree – That is, once you learn a programming language that’s actually marketable and get going with the productivity imperative. Should we conclude that the market is saturated with pretenders applying for every computing job around? I wonder why don’t they postulate for sales job, instead, where salaries are attractive and pretending can actually be a plus. Hm, I might be getting a bit cynical here… Sorry 'bout that.

To me, these “observations” sound more like a war stories than anything else. The kind told by disenchanted employers wishing for affordable “plug’n play” elite programmers they haven’t found; or by proud, devoted application developers in need of shock therapy.

I would have thought that the world was plenty with decent programmers who could do very decent work within somewhat decent working environments. Otherwise, finding good work wouldn’t be such a hassle. Perhaps there’s a mismatch in the way employers and job applicants are looking for each other… Judging by the various ways each of us answered to this post, it’s clear that we don’t all agree about what makes a good programmer for hire. It seems to depend on the job and, mostly, on our own background and perceptions.

In my case, my personal best bet would be to set up a nice working environment, hire bright enough people and let them grow. Since our profession is being mostly about shifting our understanding from the consumer to the machine, from architecture and logic to technology and implementation, I would rather build a team with complementary skills rather than give a job to every member of the LISP club who has already built a compiler. There’s more than one way to be a good programmer.

I can unfortunately say that this applies to all of engineering, not just software. I work in embedded control systems where a lot of Mechanical types end up, and most of the candidates we interview end up knowing nothing of either discipline. I’ve met guys with graduate degrees from serious big name schools who can’t solve some really pathetic problems.

The real lesson here is that how a person looks on paper will rarely reflect their actual abilities.

AndyToo wrote:
“I’ve been making a decent living from programming for over ten years, and if I may say so, I write some damn good code.”

and 90% of people who say they’re good programmers are actually horrible. :slight_smile:

no offense, but if you’ve never had to use recursion in 10 years of “programming,” then i highly doubt your solutions are optimal… heck i’m just a lowly front-end programmer and i definitely have to use recursion from time to time.

Chris, I’m with you on being wary of the precision of the writer in a lot of questions. I always wanted to argue with the multiple-choice authors when I was back in school.

That’s why I like that song that goes:

“I can’t see me loving nobody but you for all my life”

Just how precise is that?

It’s funny to see some of the solutions. I am in no means a “hard core” programmer (I didn’t know if VB had a MOD function since I haven’t used that since I did Pascal back in college). But it’s one of those tests that is so simply you have a chance not to follow the directions.

This took me about a minute to write, if I had more time I would have found out if MOD was better to use. But it covers the requirements: 1) Loop 1 to 100, 2) print FizzBuzz every 15, 3) print Buzz every 5 and 4) print Fizz every 3.

And I would have asked the clarification if they supercede each other or if you would need to print Fizz Buzz FizzBuzz every 15.

Sorry Jeff for posting a solution, but if you can memorize something like this for a job interview, then you can write a loop anyway.

CODE
’VB6
Const fizz = 3
Const buzz = 5
Const loopEnd = 100
Dim x
For x = 1 To loopEnd
If x / (fizz * buzz) = Round(x / (fizz * buzz), 0) Then
Debug.Print "FizzBuzz"
ElseIf x / buzz = Round(x / buzz, 0) Then
Debug.Print "buzz"
ElseIf x / fizz = Round(x / fizz, 0) Then
Debug.Print "Fizz"
Else
Debug.Print x
End If
Next
/CODE

Nick Franceschina’s solution is nearly perfect. The only thing that is needed is to put the isBuzz and isFizz methods behind some webservice calls, then it’s the perfect solution. Concise AND flexible. :wink:

I do not know of anyone in my Computer Science graduating class that could not write a version of this in java/c++ and at least one other language in under 5 minutes.

Who are you interviewing, and how are they getting these interviews?

i’m a professional (web) developer, often changing between php, classic asp, vba, vb.net/c#.net, sql, javascript, html, etc., etc. we do customizations to sites that have been written already.

the thing is, if you asked me to write a for loop from 1 to 10, i may get it syntactically wrong if i’ve been coding in a different language recently.

so, to me, i think asking people to code at an interview isn’t necessarily a great assessment of their ability.

Sadly, the “can’t write FizzBuzz” guys end up being promoted more often than not too.

The realities of the modern work place is that it’s more important for a programmer to be able to update his milestones in Microsoft Project and draw his designs in Visio that exports to PowerPoint than to actually deliver on his milestones.

Obviously is so many people do not answer this, then there might be something wrong with the question.

I have been in interviews where some monkey asks me to find syntax bugs by hand…what the hell is the IDE for ! You might as well give a professional author a spelling quiz (what, you never heard of a spell checker!)

I get tasked this kind of stuff during an interview these days I just leave. It is a waste of my time. The last kind of place I want to work it is one where I am asked to write menial pieces of code at a moments notice without any planning or forethought and have someone look over my shoulder the whole time. And I certainly don’t want to work with techhie freaks who only think about code syntax and the penis sizes of various star wars characters all day long

Yes, I have a PHD, developing hard core quantum meahnics simulation code. Yes, I have managed and coded commercial products that are in the market.

If you want to ask someone to do some work, then you should simulate the work environment. Let them bring in their environment, a laptop, hook them up to the internet so they have access to all of their resources. Tell them what you are going to be discussing so they can review what they need to know. Give them some time to think about what is going on? Then ask them to do something non-trivial which actually reflects the job they are being interviewed for.

Beleive it or butt munches, not everyone spends their free time memorizing the java syntax or solving high school puzzles.

More importantly and most accurately, not every stores and processes information in their mind in the same way.

I program all day every single day. That does not mean I will be able to recall the information at a momments notice or have the interest in writing code on the blackboard during a conversation. I simply don’t store and process the information that way–oh, and chance are, I don’t really want to spend my days talking to geeks all day long about trivial things.

Have any of you little nerds every played a sport? Have you tried to
do a back flip or hit a ball when someone is talking to you? For god’s sake, go get a damn book on how the brain stores and processes and retrieves information.

Learn how to interview for the job, not your ego!

Ha! I dropped out of CS in my third year to go into the clergy, and 13 years later I still was able to write FizzBuzz in C++ in about 4 minutes. Now for the real prize: CAN ANYONE WRITE IT IN ASSEMBLY?

Stu,

Fortunately, the world doesn’t revolve around your personal definitions of words. If you say answering 0x0f + 0x01 is a requirement to meet your definition of a programmer, then in your head it is. The world outside your head goes on without a single thought about who you are or what you believe.

“…how many “great” choices did you pass up [that cannot do FizzBuzz, add 0x0F + 0x01, etc?] Not many, that is for sure."

Well, in your case that must be true because you have a personal definition of ‘great’, and that’s just… uh, GREAT. Some of those people you passed up for not answering 0x10, by law of averages, are probably working on projects just as demanding as your projects if not more so, making much more than you now (assuming you rejected enough candidates). And they STILL don’t know HEX and the world doesn’t care.

Now, as for not being able to get FizzBuzz down…You’re probably on to something there.

It took me 2.5 minutes to flesh out a working fizzbuzz program in C. it took me another 2 minutes to make the program output more elegantly and to learn how to use the modulus operator (%)

The appropriate response, if in interviewing you I ask you to do the FizzBuzz task, is to say (in a loud and clear voice), “Has the customer written the automated acceptance test yet?”