weblog.masukomi.org

mah-soo-koh-me

 

Why you should add to the FizzBuzz Overthink May 21, 2007

Filed under: Uncategorized — masukomi @ 6:15 pm

I was discussing
FBO with a
friend whose work I really respect, but all he could see was a contrived
over-thought solution to an inherently simple problem. And he’s right. You can
solve a simple FizzBuzz in roughly five lines of code in pretty much every
language. But, FBO goes a ways beyond solving a simple FizzBuzz.



FBO teaches:

  • how to conceptually break a problem down into it’s component parts.
  • how to implement classes and methods and the difference between them.
  • how to throw exceptions and handle them when you encounter them.
  • how to validate user entered data and prevent it from leaving your app in an
    invalid state.
  • how to document your code.
  • how to unit test your code.
  • how correctly structured code, documentation, and unit tests should look in
    a given language.
  • how various languages compare to each other.



FBO does all of this without forcing the user to think about business logic.
FizzBuzz is an inherently simple problem that doesn’t have to be dumbed down so
that the student can easily grasp it. In fact, instead of being dumbed down, FBO
has had complexity added to it to make it more representative of a real
application. It supports dynamic modification of the start and end points of the
game which means you have to safely validate, and handle user input in a
sensible manner. A student can grasp the problem right away and focus on HOW to
break it down into it’s conceptual pieces in the example language. Furthermore,
it’s abstract enough that students don’t end up wondering about the
implementation of the features that a Blog, or Car, or whatever thing you’re
using as an example would have if you hadn’t dumbed it down so much to make it
easy to grasp.



So please,
grab
the latest version of the FizzBuzz Overthink
, translate it into your
favorite language and send me a patch at masukomi at masukomi dot org. It
doesn’t take long it’ll help some newbs ( wouldn’t this have been helpful for
you when you were a newb? ) and it’s a
fun little exercise. It’s also a great way to learn a new language.

Popularity: 4% [?]

 

Leave a Reply