views:

90

answers:

3

Hi All,

I discovered the "FizzBuzz" question today at coding horror. Great article. However, something in one of the user-comments confused me -- here's the quote:

Geez guys - EVERY ONE of you who gave example code - EVERY ONE - hard coded the FIZZ and BUZZ conditions...

It sounds to me like this poster is ridiculing people for "hard-coding" conditions, ie :

if(i % 3 == 0)
...

What is point the poster is trying to make? Is there another way to specify conditions in a program?

Thanks for taking the time!

Dan

the FIZZ and BUZZ conditions...

+1  A: 

The point of Fizz Buzz is to quickly weed out non-programmers, not find the best programmer. Any reasonable function that meets the specification is acceptable for this test.

If you don't hardcode, great, you extra-pass. But, that doesn't get you out of the hard questions that are following. I usually increase the difficulty with each question, but I don't want to waste time if the candidate totally can't answer simple questions.

Lou Franco
+1  A: 

There's nothing wrong with hardcoding some conditions.

In the context of an interview, when I know that I'm coding FizzBuzz.java and not Enterprise Fizz Buzz with a database and 1000+ simultaneous users requiring five-nines uptime, it's ideal to hardcode these conditions.

Entry-level programmers, the ones you ask FizzBuzz at least, are to follow specifications and make solutions as simple and elegant as possible. If you're an agile software house, including such features goes against YAGNI and should be discouraged. If the interviewer doesn't ask the ability to use other factors besides three and five, then it wasn't in the spec and therefore isn't needed.

Tenner
A: 

It's meant as a joke.

Jörg W Mittag