Everyone has come across this term. EXtreme Programming (XP). First thought I had was: Probably this is programming in extreme environment condition, like minus 20 degrees or hanging with your head upside down. I bet that many people had similar concept about XP. In practice eXtreme Programming is a basket of rules, methods and disciplines for Software Planning, Design, Development and Release.
Im not writing as an expert on this subject, just someone who recently introduced XP practices into my developer life.
I would like to start with something called Test Driven Development (TDD). This is very wide material so I think for today I will only scratch it. Just trying to explain basics. One of XP principles is: Write your test first, before you start coding, implementing solution. Might sounds weird, I know. It did for me, how can I write test for something that doesnt exists yet. Idea crazy but quite smart.
If I start with implementation first, I will produce code that might be useless and not important. It happens very often if developer thinks in-front. Just like I did. I add extra functionality that I dont know if will be used. Worst of all I dont know if my code has some bugs already or not. Im only human, and everyone (specially me) can make stupid mistakes.
This time lets start with test. I already have code that is testing and expecting some functionality from my actual implementation. Compiling and running test will cause failure. So I implement only as much to make my code compile and pass the test. Now I know I havent over engineered my code and Im sure it is tested.
These tests that are testing single unit of implementation (class, interface, module) are called Unit Tests. I will write more about TDD in other article more detailed with examples for Java and C#.Net.
Might seem to be a bit mess and waste of resources and developers time. Two people working on same thing. Well, in fact it is not. Two guys are sitting in front same machine. One of them is Driving (hands on mouse and keyboard and writing a code). Other dude is reviewing in a same time what the other is doing. Code is immediately reviewed by second pair of eyes. If something is not right second developer is there to spot it. If something new appear in a code, second developer is there to learn something new. When first dude stock in a black hole and have no idea how to progress then other guy is taking over Steering wheel and Driving. If none of them has any problems with implementing code, they change after every 20 minutes to 30 minutes with little breaks in between for BRAIN REFRESHMENT. Result, better quality code, reviewed by one more programmer. Better and simpler design.
Simple design is also another principle of XP programming. Software should be design and implemented simple. And it better stay this through design improvement. It will be ready for any future changes.
Continuous integration. That means that as soon as new code is written it is integrated into existing code, then build and new and old tests are fired up to check if someone has broke build. If build is broken proper information is sent to developer that broke it, so he can fix it. I have a pirate flag at my office. I was person who had most frequently committed crime of build breaking. Therefore I was named Build Breaker. Old school programming habits were taking control very often and I was committing code that broke build. Now I remember to be nice and not break build because I know there is policemen always working on build and will know as soon as I break it.
There is much more to XP. Lots of those practices are about project management not only software implementation. Some of them that I have left and will mention some other time are:
- Planning Game,
- Small releases,
- Acceptance tests,
- Integration tests,
- Design Improvement and Continuous Refactoring,
- Collective Code Ownership,
- Coding Standards.
I might missed something. Anyway, as I said, Im not and expert, I just enjoy XP ride.
It rocks and makes you feel as a developer that you have truly achieved something.
If you are interested to read more I recommend two sites:
So, for all of you crazy programmers, keep cool and stay positive.