Most of us began coding as a stream of consciousness. We typed as quickly as we could think, which lead to some interesting design decisions. If the goal was a functional program, why waste time on testing?
This theory fails as programs grow in complexity. Code is read far more often than it is written. Soon, we find that incremental changes are far easier to maintain than a large waterfall method.
An iterative approach presents its own set of difficulties. This is especially true in the case of pair programing, when accountability spans multiple stakeholders. Edits that one individual makes could invalidate another's plans, resulting in a conflict (both literally and in the technical sense!)
So how does one avoid the pitfalls of pair programming while reaping the benefits of collaboration?
One word: Communication
Imagine a team of developers as a set of tank treads. Unless they're moving in the same direction at the same speed, the project ends up spinning around endlessly. Let me give you a few examples.
As Cody and I approached this project, we knew that an effective plan was essential to success. The old model of coding as you go wouldn't cut it. Before we wrote a single line of code, we spent hours at a white board, throwing out ideas and abstracting concepts. Each idea queued a dialogue where pros and cons were considered. Had we approached these challenges individually, much of this would have been trial by error.
The flexibility of an iterative model is both a blessing and a curse. Changing requirements, however inevitable, necessitate a modular design. I began building the code once we had a blueprint. The data and processes were consistent with the plan, but the lack of modularity was not. Everything was contained in a single method.
When Cody saw this, he was frustrated (and rightly so). Had I kept him updated on the progress, he could have nudged me in the right direction much sooner. A somewhat complex refactoring followed, which introduced a bugs and hindered progress.
These experiences taught me that the importance of communication cannot be understated. Whether it's in the comments, commits, or through rough illustrations, the hive-mind mentality accelerates productivity and ensures that no change goes unnoticed.