Friday, March 9, 2007

Sarcastic FizzBuzz



I caved in, despite my instincts, and coded an implementation of FizzBuzz.

It's kind of sarcastic. Here's the code as a text file.

I hate to admit it, but coding this was kind of fun. I got the idea from a comment I made. I was kidding in the comment, but then I thought, it'd be so easy, why not.

It's kind of intended as a joke, the implementation being worthy of the problem in an ironic sense. I think it'd probably be entertaining to have a contest to cook up the least advisable, most foolish, most overblown, most heinously wrong implementation of FizzBuzz possible. This would be a good entry, although not necessarily a winning entry. Altering Fixnum can mess with your maintainability in scary ways, but it could probably be even worse if it were done in Java by executing Unix processes and capturing the output. Especially if the Unix processes used python -e as a calculator, and used Python's explicit relative pathname on a particular box.

4 comments:

  1. I think it'd probably be entertaining to have a contest to cook up the least advisable, most foolish, most overblown, most heinously wrong implementation of FizzBuzz possible.

    This reminds me of a quote by Guy Steele: "It's dangerous to make jokes about programming languages: almost every parody feature you can think of has already been tried out seriously."

    Here's a serious attempt at Fizzbuzz. There are approximately four hundred lines in the solution.

    By way of explanation, the author feels this it is important to demonstrate as much of the candidate's experience with business programming in one go.

    This is obviously at complete odds with my perspective that he only purpose of that particular question is to demonstrate that the candidate can actually program.

    ReplyDelete
  2. I just discovered that in your feed. (And heinously overreacted.)

    ReplyDelete
  3. Couldn't you replace the first test with mod 15 instead?

    ReplyDelete
  4. Yeah, somehow people get trained on methodology with toy examples, and thusly are unable to not use them in places where they are simply too simple.

    By the way: how about 'puts "1 2 fizz 4 buzz fizz 7 8 fizz buzz 11 fizz 13 14 buzzfizz ..."'?

    ReplyDelete

Note: Only a member of this blog may post a comment.