Why Can't Programmers.. Program?

shenpen - Unfortunately that wouldn’t be a valid solution (in VBScript) because WScript.echo adds a CRLF. In another language it might work though.

Sorry, but if someone were to ask me how to swap two variables w/o a temp variable I’d ask them to give me a good reason why.

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.?

1 Like

shenpen: As you point out, your solution doesn’t handle line breaks. It also doesn’t print out the original number!

shenpen, for shame. Read the spec again.

I don’t think I’ve ever interviewed a programmer quite that bad, but I did have a conversation with a contractor I was replacing once: I’d introduced a class into the monster spreadsheet he’d been maintaining and he looked at it and remarked “I wish I knew how to do that”. He was picking up about GBP400 a day (call it about $650 at that time) for this.

As I’m about to start looking for a programmer I shall be able to implement my long-cherished plan of asking candidates to submit a page or so of what they consider to be “good code”. I don’t mind if they wrote it or not, I want to see if we agree on the look of “goodness”. If we get that far, I can find out if we agree on why it’s good.

This is nasty but it’s technically a one-liner:

1.upto(100) { |n| puts n % 3 == 0 ? n % 5 == 0 ? “fizzbuzz” : “buzz” : n % 5 == 0 ? “fizz” : n }

WOW! (and not the vista kind).

I can’t believe there are people out there applying for jobs in software that cannot write a fizzbuzz program.

It’s true that knowing how to do modulo 16 using AND doesn’t relate to understanding ASP.Net.

On the other hand, do you want an ASP.Net technician, or someone who understands the theory behind it? Can you really call the candidate who only knows ASP.Net, but nothing about a basic logic a programmer (or a computer scientist, or a software engineer, or a coder), or is he just some guy who knows ASP.Net?

James: it’s amusing to me that any reference to a programming problem-- in this case, FizzBuzz-- immediately prompts developers to feverishly begin posting solutions.

  1. The whole point of the article is about WHY we have to ask people to write FizzBuzz. The mechanical part of writing and solving FizzBuzz is irrelevant.

  2. Any programmer who cares enough to read programming blogs is already far beyond such a simple problem. It’s the ones we can’t rerach-- the programmers who don’t read anything-- that we have to give the FizzBuzz test to.

But it’s OK, I mean no offense. It’s just funny. I know how software developers’ minds work. :slight_smile:

My point is that what you’re asking for isn’t “domain knowledge” strictly speaking. Using an XOR to swap two variables w/o a temp variable is only really useful when memory is expensive (embedded programming, et al). If you’re not interviewing for an embedded programmer why are you worried about it?

Same with the modulo trick. The first time I ever encountered that I was writing a Perlin Noise Generator based off of someone else’s work. Outside of routines that need to be highly optimized there’s no reason for it.

Are you trying to hire an ASP.Net programmer or an embedded systems programmer? 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).

No one can know everything. I would expect that type of attitude from a non-IT person, but not someone who is interviewing programmers.

Ha ha! I see what you’re saying Jeff.

I hope I didn’t come across as feverish though. I sincerely thought that a solution may be of interest to someone who couldn’t write one themselves.

Perhaps you have readers who aspire to be programmers but are still learning?

Perhaps a future Google search for “FizzBuzz” will bring back this page? (And the Googler might be after the solution).

Interestingly, the use of a technical test in interviews can actually work both ways. In my recent hunt for a new job I automatically turned down any vacancy where I was not given a technical test. My reasoning behind that is that I know I can program, but do I want to work with other programmers who haven’t been tested?

The harder the test I was given, the more excited I was about the vacancy.

If anyone out there is looking for a new job I urge you to bear that in mind.

Instead of using recursion, it’s often faster to use a Stack.

There’s always ‘Survivor for Developers’ for those who don’t make the cut.

http://techtalkblogs.com/blog/archive/2007/01/26/1837.aspx

I once heard of a development group where every three months a vote was taken and the bottom ten percent of the group were replaced by newcomers. It sounded a bit like Survivor - Development.

A common immediate reaction is to assume that it would become a popularity contest but that wasn’t the case. The group had very specific KPI’s to achieve and those that helped achieve those goals were well respected in the group, regardless of “popularity”. Really anti-social folk tended to get removed though. (In our company, one of the tests we use during the hiring phase is lovingly called the “no axe murderers” test. I think we have Chris Hewitt to thank for that awesome terminology.)

When working as a manager, I always felt that Australian laws made it very difficult to remove the dead-wood out of teams. Clearly, having a tribal council and an eviction for certain development groups wouldn’t work, but on this Australia Day public holiday, ask yourself this: If your team had a vote yesterday, would you still have a job on Monday? If not, do something about that now.

At the end of each week, you vote the worst dev off the island.

It’s just performance anxiety.
Most people are terrified/stressed out during interviews.
Not “Can you X?” -
“Can you X whilst terrified?”

AndyToo wrote:
“However, I have never once used - or had call to use - recursion to solve a problem, since I learned about it at university. Does this make me a bad programmer? Or is it simply that people program in different ways for different problem spheres?”

i think you missed the point: if ou were explicitly tasked to write a algorithm using recursion, would you be able to do it ? would you be able to recognise the use of recursion while reading someone else code ? and most important, the one i struggled teaching to newly hired guys and which most people dont learn at school: do you understand the principles behind recursion ?

every good programmer knows there are plenty of ways to avoid recursion, but being able to avoid it implies that you know what recursion is.

and that is the point of such a question during an interview.

Damnd thing took me three minutes to write in php. I am getting slower with old age :wink:

if ($x/3 == floor($x/3) … and so on.

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.