Monday, May 11, 2009

I Dream of SQL

The dream was solid white. In front of me, hundreds maybe thousands of lines of code were scrolling upwards, too fast to read, like I was holding down the arrow key. It was SQL code with color syntax highlighting and a musical accompaniment. As each line of code scrolled past, each word would light its own color and play its own note, like a player piano, like the old days when you could place a transistor radio next to the CPU and hear the loops and jumps in your program. It sounded terrible. Out of key, out of tune, no rhythm or melody at all. Just a jumble of notes blurring into white noise.

There I was with three sheets of player piano music, written entirely in SQL code, one for each of the three major subsystems, side by side, all scrolling together. Each word in the code would light its own color and play its own note as it flew past, too fast to pay attention to the individual SQL statements, but I could see the code structure and indentation as rhythm, the overall form as tonality, and I could see the three part harmony. Nice to know those music classes are good for more than just singing around the campfire.

First I had to arrange the structure so that the three were in rhythm with each other. Once the three database structures matched, I then transposed them to the same key. At that point bulk copies could work efficiently, but the melodies still needed work. I made my arrangements through the night, sleeping soundly, until I had a beautiful song I could enjoy. It sounded great. I played the entire composition several times but to this day do not remember how it goes.

I woke up in the morning and went to work, refactoring and rewriting the SQL code until it matched the previous night's arrangement. By mid-afternoon I was running my first data synchronization tests. It worked.

The hospital had its data model.

No comments: