April 21, 2009

Software reconstruction

April 21, 2009 - Categories: drupal

Our partners really like the Drupal-based content management system I’ve been working on, so we might roll it out to a number of other countries. To minimize headaches, we’ll probably run them as separate Drupal databases using the same code. Over the next quarter, my team needs to clean up and genericize our current US-centric site so that it can be used in lots of other geographies.

This would be a nightmare to do if we had made all of our changes on the Web. Fortunately, most of our changes are in .install files. The changes had gotten out of sync with the installation profile we created near the beginning of the project, but it was relatively easy to work through the updates and incorporate them in the profile. The regression tests I wrote are proving to be really useful, too.

There are still a number of variables that we set through the web-based interface (blame moments of weakness!), so after we clean up the profile, we’ll compare some of production tables against the tables produced by our from-scratch installation.

I applied the lots-of-little-inc-files-that-automatically-get-included-an-run pattern from our last project, so now everything is neatly compartmentalized. I improved that pattern to add weights, so now I can make sure that some inc files are run after others.

Which brings me to thinking about the proper way to backport changes from update functions back into the install functions or to the installation profile. _install functions should reflect the latest versions of the database schema, but some code (node creation, etc.) logically feels more like a part of the installation profile’s final steps. My current approach is to use the _install function for code that doesn’t require other modules to be correctly configured, and to use my custom _install_final method for the finishing touches. I’ve also broken site-specific code out into separate .inc files so that I can include any of them as needed, and I’m using regression tests to check that things are okay. Command-line drush and my Makefile make it easy to switch between the two virtual hosts.

Most of my tests are still fail, but some of them pass with from-scratch installs. Hooray! =D

Learning to play the piano

April 21, 2009 - Categories: life

I’ve been teaching myself how to play the piano, and I really enjoy it.

My parents arranged piano lessons for us when we were kids. I didn’t enjoy that nearly as much. The pieces were unfamiliar, and the rules of piano-playing seemed so strange. Read the notes, play the drills, curve the fingers. One piano teacher kept scolding me because I didn’t read the notes–but that was because I had figured out the pattern of the simple exercises we were doing, and my restless eyes couldn’t keep still.

Fast forward a decade or two, and now it’s one of the things that makes me smile. I like being able to play simple arrangements of Moonlight Sonata and The Entertainer from memory. I’m currently working on learning Prelude: Op. 28 No. 6 by Chopin (PDF, Mutopia link). It’s one of W-’s favorites. I’ve been looping over his CD of Vladimir Horowitz (A Reminiscence) playing that and other beautiful pieces, and I’ve been slowly making progress on learning the piece. I can do the left hand with a few pauses, and I’m learning the right hand chords. The timing reminds me of The Entertainer, although the prelude is more complex and it’ll be a while before I can do the proper dynamics.

What I enjoy the most about learning how to play the piano is being able to chunk more and more complex segments: first notes, then chords, then phrases, and then eventually even the pattern of a piece. I love the instant feedback of knowing how close you are to doing things right, and the gradual improvement of playing a piece very slowly and then speeding up as I become more familiar with the way my hands must move. It is a welcome break after work, or even sometimes during the work day if I need to perk myself up. Playing the pieces that I’ve learned reinforces that feeling of competence, while working on the piece that I’m learning reinforces the joy of experimentation and growth.

Another reason why I enjoy playing the piano is that I also end up inspiring J- to experiment with it, to play music and to play with music. When I sit down at the piano, she invariably comes to listen. I move to the left so that she can sit on the piano bench, and I help her practice a few pieces she wants to learn. I mostly just point to the notes on the sheet to help her keep track of where she is, and sometimes I’ll play passages for her. This turns it into a bit of a memory game, too.

She told me I’m a better music teacher than the last one she had. Me, I just want to help her get even deeper into the joy of learning. =) And it pays off. Sometimes, when W- and I are working in the kitchen, we hear the faint strains of someone figuring out a new piece of music–from one of the piano books lying around, or from her memory.

These experiences would be much more difficult to have if we didn’t have a piano in the house. Now that I’m starting to get the hang of it, I wish I’d opened up and let myself try it sooner, on the piano in my parents’ house. But maybe I needed to listen to a lot more music in order to enjoy playing it, and now that I can play a little bit, I’ll enjoy listening to music even more.