Writing code is the main focus of XP (eXtreme Programming). XP strips out many of project activities for the benefits of the coding stage. The most notable difference is that coding is done inpairs. The two developers are sitting in front of the computer, one does the typing, and both do the thinking. At a first glance, it may seem like the waste of time (two people typing may produce more code). The practice shows opposite effect. This may be explained by the following:
- Challenging coding tasks are discussed on the fly (brain-storming works);
- Coding undergoes instant code review;
- The practice allows bringing less experienced developers up to speed quickly;
- People tend to spend less time on non-related activities like reading emails, browsing Internet etc.
XP promotes refactoring. Refactoring is a process of changing code to make it better, without breaking the existing functionality. The resulting code has higher quality.
XP rejects the idea of code ownership. While designated programmers create the initial implementation, anyone can modify the code. The practice of browsing/modifying the code of other developers widens knowledge about the system as a whole. If someone leaves the team, the negative impact of lost knowledge is minimized. There is a natural restriction on collective code ownership: one should never modify the code he/she doesnot understand. This restriction becomes visible in larger projects.