Saturday April 15, 2006 | S Marks The Spot To hold a pen is to be at war. |
|
Increase the Ratio of Thought to Lines of Code More on pair programming... Nearly two years ago, Rich Berlin blogged some observations about pair programming. He mentioned an idea that he and I came up with: Increase the ratio of thought to lines of code. Turns out that a similar piece of paper from that meeting I had with Rich is still posted outside my office. I think the meeting was all the way back in 2001. It wasn't actually that much of a meeting, as I recall, it was more of a whiteboard conversation. But it did result in a few insights that I thought were worth writing down. One topic in particular is the number of bugs programmers write. Dijkstra observed that “If debugging is the process of removing bugs, then programming must be the process of putting them in.” My observation is that programmers do write lots of bugs, most of which are easily preventable. <lament>If only programmers were more careful!</lament> This is really a counsel of perfection. Simply telling programmers to be more careful or to write fewer bugs is ineffective. One way to let programmers be more careful is to take some pressure off and not overload them. Programmers under pressure often subconsciously or willfully ignore potential issues, since they are apparently obstacles to completing the task at hand. With less pressure, programmers can take more time to think about their code and to investigate unresolved issues instead of just checking it in and moving to the next task. But that doesn't mean they will take more time to think about their code. That's where pair programming comes in. One aspect of pairing is keeping each other honest. A senior engineer paired with a junior engineer can instill greater discipline in the junior engineer, encouraging him or her to fix the problems now instead of postponing them until later. It works the other way, too. As a senior engineer, if I know a junior engineer is watching me, I feel compelled to set a good example. I'm always on my best behavior. (And boy, is that tiring.) Another aspect of pairing is, as Rich said, “Two heads are better than one.” Two people will be looking at different things. The union of problems they'll find is greater than either one of them alone. This applies for senior-junior pairing or pairing between peers. Nobody is so perfect that they never make mistakes. There are a few other topics from that discussion with Rich that I'll save for future blog entries. Stay tuned. Posted by smarks ( Apr 15 2006, 11:33:53 AM PDT ) PermalinkComments:
Post a Comment: Comments are closed for this entry. |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||