In the summer of 2009 I revisited my 2004 summer apprenticeship at Object Mentor. What follows is the original 2004 post and then some 2009 commentary.
There’s just one problem with our conversion program: the Double Dash (cue the dramatic music). In FitNesse, two dashes in a row (–) mean strikethrough. But in the old OMwiki, two dashes had no meaning. A fair amount of people use two dashes to separate their thoughts ‘ as you might expect. So our pages were getting translated with lots of text ‘struck out.’ Okay, so all we had to do was write a program that looks through all the wiki pages and replaces two dashes with one. Which, it turns out, is not as easy as we thought. The proper way to do this is with regular expressions (mentioned in the previous post), but neither Paul nor I understand them too well. So we looked around for the regex (regular expression) book at OM, but somebody had probably taken it home for some light reading. With that option crossed out we started to build a series of nested if statements. After getting about 5 if’s in, Paul turned to me and said ‘If Micah sees this code, we’re telling him that YOU wrote it.’ Fair enough. Well, the problem with nested ifs, as you might know, is that it’s hard to keep all those conditionals straight (if this, but not that, and this, that, and the other, wait! No, not the other. Or, uh, let’s start again.) so we quickly got lost. Then we gave up. It was just too messy to keep track of how long the string of dashes were. We wanted to change two dashes in a row, but no other length was to be affected. So we started looking up regexs on the web. An hour or so later, it was time to go.
Incidentally, I made my train with only a minute to spare. Really, really, big wind today.
Here’s the weird part: I just figured it out while on the train. Using Java’s API (a guide to all the classes and methods in the Java library) and some tutorials I downloaded off the web, I talked the ‘matcher’ into finding dash strings of any length. If the length of that string was two, I replaced it with one dash. If not, I kept the string the same. Nice.
Gotta say, I feel pretty good about being able to contribute something to this project.
So mark down July 1st, 2004 as the day I felt like I really might be able to become a programmer. Since starting at Object Mentor I had contributed almost exactly nothing except for the occasional “You spelled that wrong.” But on that hallowed day I actually figured something out before Paul. Maybe I wouldn’t have to go back to teaching high school remedial physics and hating Sunday nights because of what Monday promised. Heady thoughts.
Interestingly enough Jay Fields wrote a blog post about the “Spellchecking Pair” a few years later. He makes some good points about matching the levels of programmers but:
A. That’s not always possible.
B. I’d feel pretty bad if I was a junior guy on his team when he wrote that post.
C. Inexperienced devs already feel like they are worthless – try not to make them feel worse.
Still it’s important to talk about the problem – you want to bring developers along but sometimes the impedance mis-match can really frustrate both developers. I generally err on the side of “pairing increases the long term health of the project,” but of course their are exceptions. It’s just that the exceptions have a nasty way of becoming the rule.