FizzBuzz: the Programmer's Stairway to Heaven

Compulsive puzzle solving is right. Both my wife and I are coders, after reading this I related the results and basically both of us started figuring out other questions of similar weight [after answering the question as quickly as possible first]. Yet another astute observation, Jeff… kudos.

I think it struck a nerve – a well coded algorithm to solve a “problem” than can be easily grasped gives one the chance to “create”, solve, whatever, and some people got that buzz to try it out.

Used to be that we had less to “care about” – there were no frameworks, browser issues, dev tools with a zillion options and windows, and event programming was still future except for catching keyboard interupts.

I was a math major at Cal and couldn’t get into the CS department. Even though I did lots of engineering and numerical analysis coding, the concepts of registers, assembly code, and other vital nuts and bolts that you may never use but help one grasp the bigger picture were missed.

I was in “high” school when STH came out, but truthfully LZ’s first album is still better. We made fun of Black Sabbath’s “Iron Man” because it was only 3 chords, but listening to it today, the guitar solo is better than most of what I hear. So I have mellowed or today’s guitar playing is not so good.

“Officially”, the rock era of the late '60s/early 70s ended with Bad Company.

I like the question ‘why we have to ask people to write FizzBuzz’. I think it is because the notion of what programming IS has changed (eroded?) over time. For example, in the late 60s if you claimed to be a programmer, you likely had the skills for FizzBuzz. But now I often hear of ‘HTML programmers’. AFAIK, HTML doesn’t have much in the way of flow control. Also, I rarely write many complicated algorithms any more, I just use existing stuff from the C++ STL or the JDK - but it is important that I know how to use them (compose with them, etc.), rather than just look for a magic method that does exactly what I want in a single line. ‘There’s no keyword or library function to do that’ isn’t an excuse to me.

Now my rant turns personal. I work for a government agency, and I find I get paid on the same scale as an ‘HTML programmer’. I work on distributed simulation systems, and do a fair amount of system level coding. I’ve done a couple of web projects before I joined the gov’t, using servlets, SQL, etc. In my experience I rarely meet people who can’t write FizzBuzz in my recent work, but I encounter people doing web development who probably would have a tough time with FizzBuzz - and those same people (who haven’t walked in my shoes) will remark how challenging their work is. My private thought is, if you think that’s difficult, try my job for a day. And I have walked in their shoes. OK, my rant is done now.

Brandon:
There are good programmers who can solve problems with resources (again not specifically thinking of FizzBuzz here) and a lack of pressure that will undoubtedly make mistakes in an interview. I’d say their approach is far more important than the actual results in this situation.

Knowledge and experience can be acquired if a little lacking, but your approach to programming (I mean the way you think as a programmer when solving problems) is difficult to change once you have it.

“Is there a term for people who compulsively answer rhetorical questions?”

Yes, programmers. Apparently…

if(hedgerow.Contains(bustle))
{
   alarmState = AlarmState.NotAlarmed;
   bustle = SpringCleanForTheMayQueen();
}
if(hedgerow.bustle) {
  alarmed = false;
}

mayQueen.springClean();

Maybe you should give us something tougher than FizzBuzz.

That’s spooky. Stop it.

We ask questions like FizzBuzz because interviews are short, because programming involves a great many skills and concepts, and we might as well screen for the basics immediately, and because the question probably has high predictive value.

I wouldn’t give a candidate more than 60 seconds of my time to demonstrate that he/she knew how to handle FizzBuzz before moving on. “You don’t need to write code, just explain how you’d do it.”

I interview a lot of people, these days mostly hardcore quants, with degrees in the hard sciences, who almost certainly had to sling code at some point, but who may not be very good at it. For me, the interesting side topic here is:

What is a good set of basic questions – like FizzBuzz – that one can use to quickly cover the bases of programming skills and concepts? To quickly determine if you’re talking to the real McCoy?

There was some discussion and criticism of “puzzles” and “trick questions” on yesterday’s thread. I’m not into tricks. I posted a couple of my standards yesterday, the “four cards” problem and the hash table question. In my experience, these questions have high predictive value. They’re not remotely reliable on their own (not getting the four cards problem, all by itself, means very little), but combined with a substantial number of other problems, they draw a clear picture in a short period of time.

I’m looking for “Bladerunner”'s voice-comp test for programmers: “I’m going to ask you a series of simple questions…” Because for me, the hard part is separating the wheat from the chaff.

When I was reading the non-solution comments with other more advanced questions, I thought that often the first idea I have is not the best. Quite often I figure out an improvement over night. I don’t know how I would do in an interview expecting “instant” best answers. For example, on the “are two strings anagrams of each other” question, I thought:
sort and compare
count number of each char and compare counts
what if it is unicode? count with hash map?

BTW I have been writing assembly and embedded programs for 20 years and cannot remember ever swapping to variables “in place” by hand. (There areinstructions to do it on many processors that I have used.)

I tried to ask a question on this blog yesterday amid the torrent of code, but I’d like to ask it again since it was impossible to get a response. It basically went like this:
I’m by no means an excellent programmer, I’ve only studied C and C++ as a hobby for a few years and written a few thousand lines of code and some silly and incomplete 2d games. The alleged inability of CS majors to even solve the Fizzbuzz or equivalent, plus many poster’s inability to have the social skills to not flood the blog with illegible, or “clever”, code makes me think that I could be competitive for an entry level programming job, at least in C. I had never considered applying for a programming job before yesterday.

Is that a bad attitude? I really like coding but would I be simply adding to the wave of noobs in professional positions? Should we leave programming jobs to those who grok it in the highest degree?

so…why not use this to the advantage of codinghorror. Wright a weekly challenge or something. One, it could be fun and two. It might be a good way to learn from other people. There is never just one way of doing things. It would be interesting to see how other people solve problems.

Bryan

You’re right, I don’t play “Stairway to Heaven.”

But I rock the Hell out of “Foggy Mountain Breakdown.”

As a student programmer, after reading this, my first instinct was to create a ‘solution’; Like the rest, I’m a compulsive problem solver. I’ve only been in classes for 4 months, yet feel like a task this simple should be redundant. During nightly practicals, I’ll crank out a oversimplified templated singly linked list, just because I think that this may be what I would be requested to do in a professional environment. Things like loops and conditionals are such second nature to me, and even after only 4 months of program, I would assume that any ‘senior programmer’ would be able to turn out a little under one hundred bytes of code in the blink of an eye. I suppose that which is constantly reinforced at my school holds very true:

Learn the hardest things, and remember them. Don’t ‘learn and remember’ the simple things, know them so well that they’re the fiber of your very being.

In a professional environment it usually boils down to something related to an excel spreadsheet.

oops, sorry, I thought it was a job interview.

wait, does this mean i won’t get the job?

:wink:

No FizzBuzz?! DENIED!

Maybe we compulsively answer FizzBuzz questions because many of us have Autistic Spectrum Disorders and saw the answer before completly reading the problem statement? Or it could be one upmanship.

So, let me get this straight: you asserted that many programmers aren’t worthy of the title, proposed a simple problem to establish some basic credibility, and were surprised when your readers commented?

Also just in: three seconds after you finish reading this sentences, you will be thinking about an elephant in a tutu.