April 29, 2008
The Myth of the Lone ProgrammerThere was a recent article on Slashdot with the salacious title Donald Knuth Rips On Unit Tests and More, implying that the Lord of Algorithms thought unit tests were a waste of time. If you read the actual interview, you will see that Knuth is simply saying that in his own experience writing code, he has never found much use for unit tests.
My interpretation of this is that Knuth has never had to write a particularly large piece of software where he was not the only author. Because that is where unit tests can really help: preventing somebody from accidentally breaking somebody else's code when they make a change. If you are the only author, you may have a good enough idea of the code in your head to prevent such errors (although it would be somewhat conceited to think you would never do it accidentally).
Knuth's idea on how people should write code is an idea he came up with called literate programming, which involves creating a document that describes the code and also can have the source code extracted from it. Knuth introduced literate programming in a language called "WEB", which he used to write TeX (my father says that Knuth chose the term "web" because back in 1981 it was a three-letter word that had no existing computer-related meaning). Literate programming is not a bad idea, but the notion that it would solve modern programming problems is simplistic--unless you are only thinking about software written by one person (as an aside, there was somebody, I don't know who, who used to work in Engineering Excellence and misinterpreted "literate programming" to mean embedding comments in your source code that could be extracted by a tool to produce documentation--what programs like Doxygen and Sandcastle do. So in our slides there are various incorrect uses of the term, every time we talk about documentation generators).
In my class this week I happened to have somebody who worked with me at Softimage back in 1996, and we were reminiscing about some of the programmers who worked there. In particular, a couple of the key architects on the product were "lone wolf" type programmers who spent their time cranking out code and didn't interact with people much, except possibly to point out things they were doing wrong. This led to various zany designs and rules that didn't make much sense, but which it was a losing proposition to try to argue against (the most notorious of these was the stipulation that include files in C++ sources had to be alphabetized by filename; it's a strange enough rule that it's hard to think of a real-world analogy, but you might consider a university where you were required to take all your courses in alphabetical order by course name).
You still hear people gooing and gahing over programmers like that: "they don't talk to anybody, but they sure write a lot of awesome code!" In prior eras at Microsoft such programmers were celebrated, and then we went through a period where they were tolerated, but now I think the pendulum has swung, correctly, to view such people as negatives on a team.
Looking back we probably should have cashiered those guys out of Softimage, but from the inside it always seems like it's worth sticking with them in the short term because the temporary pain of losing them would be so great...but it's not worth it. Hatching a giant code egg all by yourself, even if it is "good" code (and it very likely isn't), just isn't a key part of being a software architect. The job is really all about helping others succeed, growing the skills of the team, representing your team in interactions with other teams, and so on. Sitting in your office with the door closed accomplished none of that. Arguably it would be a case of "what got you here won't get you there", except that in retrospect it shouldn't even have gotten them here.
April 20, 2008
Driving on the Other SideI popped over the pond for a spot of teaching in London this week, and right now I'm relaxing in the British Airways departure lounge at Heathrow, which has a bunch of free computers (about half of which actually have the magic combination of a mouse that works and an Internet connection that works).
I rented a car while I was here, figuring it would be entertaining (never haven driven on the proper side of the road before). I was concerned about remembering to turn into the correct side of the road, but that actually wasn't a problem--having the steering wheel on the other side was enough to remind me. I did have a few minor things that kept happening:
- I would drift a bit to the left of the lane--not into the next lane, but just a bit, I assume trying to compensate for a subconscious feeling that my body was in the wrong place.
- I kept reaching for the seatbelt on the wrong side of my body.
- When I wanted to in the rearview mirror, I always looked to me right, then wondered why the view out the side mirror wasn't what I was expecting.
A bigger problem was how narrow the roads were. On the way from my hotel to the training site I crossed the Chertsey Bridge, which was spot-on lovely, but was built in the 1780s and, as somebody put it, is wide enough for a horse and buggy to pass in either direction. Which makes it a bit tight if a lorry and a motorbus try to pass, or even two cars, if one of them is driven by an expat American trying to find second gear on his car.
The narrowness also made it hard to navigate because you couldn't stop for a second to look at a map without risking a head-on collision (not that such map-checking behavior is advised anyway). And it's a bit hard to navigate in general because street signs are a bit rare and the names change often anyway, so you have to follow the numbered roads, which follow more logical paths from town-to-town. But if you miscount at a roundabout and head off in the wrong direction, it can be very hard to figure out where you are, especially since the road numbers are only signed at roundabout exits. Furthermore at any given time there was some annoyed driver riding my bumper (the roads seem to alternate narrow and less narrow spots, so I think people hustle through the narrow spots to minimize their time spent in them). I wound up feeling a bit stressed most of the time I was driving, which I have not felt before, even in unfamiliar locations. On the first day I faced an oncoming bus on a narrow street, and had no choice but to put two wheels up on the opposing sidewalk, leaving me inches from the stone wall that conveniently bordered the road, for maximum claustrophobic effect. Nobody seemed to put out by all this, in fact there must be some unwritten rules on when you park your car half on the sidewalk and when you don't.
All-in-all I did enjoy driving in England. By the third day I knew where I was going and was passing bikers in front of oncoming traffic just like a seasoned Brit. And today I managed to make it back to the Avis rental return with the car and myself intact. The correct answer to all this might be "rent a GPS for the car", but that wouldn't be much fun, now would it?
April 12, 2008
Yes, No, or SomewhatI received this error on my Vista machine at work the other day:
(Of course I have Windows Update on; I don't think I could get away with having it off on the corporate network.) I found the message amusing, and I can understand the reason why it would be presented to me; but I can predict that other people would feel other emotions when they saw it.
There is actually a space below where you can enter a comment and send it in...since the message has nothing actionable in it (in fact I have no idea what it was about, the machine seems to be working fine) I'm curious what kind of feedback people send in.