Wednesday, December 12, 2007

Jeopardy in a 30 Minutes or Less

For the last couple years, Shira has put together a fun Jeopardy game for her office. And every year I watch her do this in PowerPoint and cringe. It's not so much the basic creation of the game (one slide has a big grid on the it, and uses hyperlinks to slides with questions) - but it's the tweaking that gets me. Whenever any change needs to happen, there are inevitably a ripple of additional changes.

So last night I did something about it. We decided to work in parallel - she'd start in on the PowerPoint version and I'd roll my own app for her. After 30 minutes, she was making good progress with the PowerPoint, but I had a beta version for her to play with. It was good enough that it convinced her to go with a more custom solution.

Check out what I ended up with here. It's an HTML / CSS / JavaScript solution, and you're welcome to grab and use the files however you wish. (Sorry about the lame default questions - I was in a hurry.)

Here's a few lessons learned from this quicky app:

  • JSON rocks! I was quickly able to roll my own file format, just like I might with s-expressions. And best of all, didn't have to spend any time on a parser. Hopefully, JSON will keep replacing XML as a format choice.
  • The HTML / CSS / JavaScript solution turned out to be a good choice. I could make a fairly dynamic app, yet have the files copied to a thumb drive and usable on any computer with a browser. No need for a network connection, either.
  • Surprisingly, laying out the main grid using CSS floats was way easier than if I had used old fashioned tables. I usually try to go tableless because it's the Right Thing Todo. But in this case, it saved a big chunk of programming headache.
  • Thanks to prototype and an HTML library that I've worked up, creating dynamic pages in JavaScript is really painless. And the HTML library allows me to make tags easily using JavaScript syntax, so I don't end up with a mess that's got tons of HTML tags embedded in my JavaScript code.

Shira uses the app in a few hours. I guess that will be the true test of whether or not it was smart to roll my own solution.

No comments:

Post a Comment