Old Articles‎ > ‎

ExtremeProgramming

This series of articles is intended for developers who have a preliminary process experience and want to get started with XP.

Introduction

Extreme Programming(XP) is a lightweight software process concieved by Software Guru Kent Beck.It is evolutionary and natural in appeal.It is suitable for projects whose specifications change frequently and have a small team(10). 

Stages of Software Development in XP

At the first glance, besides the specification stage,the whole XP process seems to be upside down.
  1. Specification
  2. Testing
  3. Coding
  4. Designing (Refactoring)
How can someone test before writing the code?

XP promotes test first methodology.Writing test code precedes the writing of the actual code.Every quality production code is written to meet some requirements and it is necessary to setup some criteria to ascertain the same.The job of test code is to check whether the production code meets the set criteria.

But other methodologies also have provision for testing , then how does XP differ ? Agreed , other methodologies do have testing phase but there the testing begins when most of the code is already written and testing is a "means" to an "end" viz working code.In XP its a bit weird. In XP testing code is the "end" and not the "means".If the test code runs perfectly with not production code written then the XP programmer is satisfied and the project is over !!!. But, alas that is not possible so the XP programmer writes the production code against with the test code will run and be successful.

Incremental Development

XP programmers don't start with all test criteria at one go.They believe in incremental development.Initially a small number of criteria are considered and test code developed.The production code is developed and tested against the test code.If the test runs fine then its time to add few more criteria in test code and functionality in production code.If the test does not run well the production code needs rework iteratively. This approach instills many good qualities in the software.

  1. As the coder has a test focus , he tries to write a code which is not only functionally correct but also testable.The software is testable at a very fine resolution as the testing procedure has been followed from the inception.
  2. The coder's temptation to go beyond the actual requirements to add flexibility and goodies is restricted as the test criteria clearly embody the requirements.
  3. Changes in code to add new functionality or improve its structure , are not allowed to affect the already built in functionality.This is because the test code would catch any such anomaly.
  4. Although the word "increment" has a connotation of "small change" it has a subjective color.The developer is free to decide the unit to functionality he wants to add to the software in next step.This is very natural and evolutionary in principle and the developer gets a lot of confidence and understanding of the project as he grows with it.

Coding before Designing ?

Extreme programmer doesn't worry much about perfect design to start with.He is interested more in what he has to deliver to the client i.e. working code.This is not to say that designing is neglected. It's just that coding gets priority over excessive design.

Then don't we lose benefits of good design? No

  1. Benefits of good designs are anticipatory and most of the time because of rapidly changing specifications have very little ROI ( Return on Investment).
  2. XP is not averse to designing. When the coder feels that his code has lost its structure he starts refactoring the code.Refactoring is the process of moving the shapeless code towards structured code which is simple, flexible and probably efficient.The code being functionally correct , as is always assured by test code, must not lose its correctness during refactoring. Design patterns and Software Architectures provide good targets for refactoring process.
  3. Experienced programmers can think two or three levels deeper than a novice and may directly generate code which embody good design.This reduces refactoring effort.XP tries to remove the blocking state in the design phase because of lack of details which can only be practically obtained during implementation.XP says, "if you are blocked while designing start coding and if you are blocked while coding start designing(refactoring)".

Concluding Remarks

This article tried to give an overview of some of the main stages in XP development and the discipline it tries to promote.Other articles will address the remaining stages and also the stages covered here in greater detail.