18 April 2014

Another quiz idea for your consideration: Code Pong

Thanks for all your feedback on the PL/SQL Countdown quiz. I am certain we will add that to the mix soon.

And since I have decided to no longer keep all my best ideas to myself ( :-) ), I offer another idea for a "quiz", though it is not really a quiz, I suppose. More of a "game"?

I call it Code Pong (some of you may know of the classic Pong game). Here's how it would work:

It starts with a piece of rather awful code (likely a function or procedure that is supposed to do X or display certain output). It has all sorts of issues: outright bugs, typos, logic flaws, etc.

Two people sign up to play. And they each take turns applying changes to the code to improve it. The rules for making a change are:

1. You can change 1 line.
2. You can insert up to 3 lines.
3. You can delete up to 3 lines.
4. You can reject the other player's last move.
5. Assert that the game is done.
6. Accept or reject other player's assertion that game is done.

Player must include a description of the change: how does it help get closer to a solution?

What this means is that you can't make one big wholesale change to the code to fix it. Instead, you must work with the other player, sometimes following their lead, sometimes leading the way, to make changes until you believe the code works and all the problems are removed (that is, it not only works, but also is now a program that is easy to understand and maintain.

Here's a simple example: Change the code so that "9" is displayed.
   l_index NUMBER;
   FOR rec IN (SELECT * FROM all_source WHERE rownum < 10)
      l_index := l_index + 1;

Move 1 (player 1):

Change line 2 to:

l_index PLS_INTEGER;

Explanation: PLS_INTEGER is faster than NUMBER and you do not need NUMBER.

Move 2 (player 2):

Change line 2 to:

l_index PLS_INTEGER := 1;

Explanation: the default initial value is NULL and adding 1 to NULL returns 1. So l_index stays NULL throughout.

Move 3 (player 1):

Assert that game is done.

Move 4 (player2):

Accept; game is done!

What do you think? Too complicated? Too strange?

13 April 2014

Take a Survey on Database Design Quizzes

Chris Saxon, who is the "domain admin" for the Database Design and author of many of the weekly quizzes, would love to get feedback from our players on these quizzes. He's been doing them now for six months and figures it's time to check in with all of you.

So he's used Google Forms to set up a quick, anonymous survey:


We hope you can take a few moments to fill it out.