Amit Gajjar, eInfochips
Extreme programming is a concept for executing project with simplicity, collaborative and in friendly environment. There is no fixed strategy or set of rules to execute extreme programming. Frequently it is also called as XP. Extreme programming is one of the concepts of agile methodology. We are going to discuss about XP with simple examples. Pair programming is the main concept of extreme programming.
XP is very flexible for customer and developer. It is continuous and iterative process. It improves design, testing and development by every cycle. Requirements are in form of rough documents. There will be manager, who is looking into the communication, coordination, and pairing activity. He is responsible for figure best pairs in pair programming. He is also responsible for converting all customer stories into small tasks and assigned it to pairs. With every cycle customer and team decide all priority tasks for first release. They prioritize task according to deadline and availability of resources. Release plan can be revised regularly.
Customer & Customer Communication:
When we are saying customer, it is single person who used to communicate with Team about Requirement and provide domain knowledge. Customer should be very well understood with his requirements. There should not be multiple persons from customer end who provide us his/her domain knowledge. When more people are involved, confliction between them may cause some issue with requirement. There are couple of qualities required in customer when you are dealing with them. Like,
- Customer should have knowledge of project domain.
- Customer should be available when required or he should be easily reachable by email/phone.
- Customer should be very serious about the project and all deadlines.
- Decision power should be very strong.
If customer is not confident about what is required, project may lead to wrong direction. All above qualities are very important for project success.
If we are doing work with the help of some one, it will always increase accuracy of that work. There are many real time examples like,
- Two pilots are taking care of aircraft at the time of takeoff or landing.
- In car racing game, Driver is with co-driver to help him in some critical situation.
- Even when you are doing some critical task, you keep someone with you.
Similarly, Pair programming is key feature of XP. In Pair programming two persons are working on same terminal. One is writing code and another is just watching and observing. Frequently they switch their position. Analysis says pair programming reduce bug rate from 15% to 50% depending on project complexity and programmers expertise.
Well known companies like Twitter and Facebook follow pair programming partially. There are several advantages of Pair programming over working separately.
- There are very less probability of bug and hacks.
- Code will be clean as someone is monitoring coding convention, spell checking.
- Well designed and clean code is very easily maintained.
- You can eliminate code review. Some companies follows both pair programming and code review. Its all depends on your process.
- Design defects can be catch earlier.
- Pairing keeps you honest. You will not going to wasting your time when someone is monitoring your work.
- Knowledge transfer process can be eliminated when employee exit the organization.
New pairing is created after 2-5 days. Rotation is carried out depending on the length of the task. In Pair programming managers will try to keep rotating people. Each one should get chance to work with everyone else. Sometimes they are following patterns for pairing.
In below figure, arrow indicates two new pair. In the pair, one person will be moved with other one. The person who is new will be driving and the experience person could be navigator. After rotation each team have one novice person and one expert person. There are several patterns of rotation. Ping pong pair, Chess clock pair, staircase are famous pairing methods.
Figure 1.1: One of the possible rotation methods in pair programming
Our goal would be for every developer work with every other developer. Let me give you example of staircase to achieve this phenomenon. To make sure one is working with everyone else we are creating one matrix here. If you have 6 team members, you will have 6x6 matrixes.
Table 1.1: Matrix for six employees all possible combination
In above [Table 1.1] matrix all red cells are impossible combinations as they the same person. All orange pairs are just a repetition of green pairs. If [A, B] is pair then we should not say [B, A] is another pair. It is managers responsibility to check if all green pairs are formed at least once.
In [Table 1.2] we have one possible combination for six employees with three pairs on 5 weeks project. You can change pair in 2-5 days. Rotation occurs depending on project/task lengths.
Table 1.2: Weekly schedule for employee combination
There are some disadvantages or challenges in pair programming.
- Some people are very lazy in nature and some are very hard working. Lazy people always de-motivate other peoples.
- Additional expense for Devices and infrastructure is required for pair programming.
- Sometimes single person can work faster on some problems. Two people working one same problem will not do it quickly.
- Some managers thinking that total work done will be half in case of pair. Its true but it will also increase quality of code.
- This may cause problem when one of the employee take unplanned leave.
- Other challenges are Odd number of developers, Ego, conflict in nature.
Sometimes because of budget issue Customer is not accepting pair programming. And in case of fixed prize project companies are not prefer for pairing.
Although code review cant be eliminated but it is very easy process in extreme programming. Code is passed through two eyes. It is always something good when two people put thought on the same code.
It is very difficult situation for newbies, when some expert groups are giving review comment. In case of pair programming there is always a guild who could guide throughout the development. There are very less chances of major defects from newbies.
Testing application eliminate many issue at the time of maintenance. Without test cases if we have any changes in middle of project, it could lead us to some serious issue. If we have covered all code under test cases then we can prevent some hidden issues.
Automation testing is preferable compared to manual testing. Sometimes automation testing is bounded with nightly builds. Every day along with latest build automated test cases are executed. In case of failure issue can be resolved or change set can be withdrawn.
Extreme programming is very helpful when you have enough resource and budget to invest on big project. It will improve code quality and help you to protract in the market.