Welcome!

Java Authors: Don MacVittie, Maureen O'Gara, Liz McMillan, Walter H. Pinson, III, Yakov Werde

Related Topics: Java

Java: Article

i-Technology Opinion: Why Use Extreme Programming?

It's Not Just Another Development Methodology

Key Concepts of XP
This methodology is designed around the typical common sense approach to development; however, these fundamentals are outlined in detail to ensure your understanding and to highlight their importance.

Planning
Planning is the cornerstone of any project's success. During the planning cycle, it is important to communicate with the customer to determine the scope and the schedule of the project. These two factors are used in your typical triangle approach (scope, schedule, resources) and will help to determine which elements have a higher priority. This information will then be used in laying out the release planning. One of the fundamental differences in the planning phase used in XP is the implementation of user stories as a way of capturing use cases. User stories are written by the customer and are simple requirements that must be met by the software. It is important to note that user stories captured during the planning phase should be high level and should not include any technical jargon. In addition, stories should be small enough to implement in no more than three weeks. These stories should not be longer than a few sentences and should provide enough detail for the developer to estimate the time required to implement. During development, the programmer should ensure the understanding of the user story by communicating his or her version of the implementation with the customer. This information will be used to generate acceptance test code, thus making sure that customer requirements are met.

Designing
The design phase should be a time to validate overall functionality while also focusing on the details of the individual user stories. One of the key concepts to keep in mind during the design phase is to keep it simple. It is extremely important that developers do not add unnecessary complexity during the initial design. XP promotes the idea of refactoring code; refactoring should be an integral process, shared by all developers during development of the software. Therefore, a simple approach is the best approach for initial design. It is also important to outline naming standards during the design phase. At this stage, it will be easier for developers to agree upon and understand the naming conventions. It is important to select names that all team members can relate to without learning detailed business rules. This will ensure a quicker understanding of the overall system.

One of the pillars of the XP design process is collaboration. It is critical that collaboration meetings are held. This is referred to as Use Class, Responsibilities, and Collaboration (CRC) sessions in XP speak. During this time, the developer of an individual component will explain how his or her object will communicate with other objects in the system. This will provide a means to quickly uncover problematic issues and shortcomings in the design. The CRC sessions are written on cards that can quickly be converted into collaboration diagrams if a more permanent record is required.

Coding
The key difference in coding with the XP methodology is communication with the customer. During the coding effort, developers should never try to guess or implement solutions they think meet the requirements of the user story. Instead, they should talk to the customer. This is why XP works. If the developer does not fully understand an implementation, he or she should feel confident in explaining and validating his or her understanding with the customer.

Another key difference is the priority placed on testing. During the coding phase, the developer should always build the test case first, even if the test case is only a written process that can be implemented into a testing tool. Creating the test case first makes it easier to write the code to pass the test case. In addition, because several of the test cases are captured in the user stories, the individual module should be very close to the customer requirements. Another benefit of creating test cases is that it provides an understanding of how the code works. This also means that other developers can ascertain how the code works by reading the test cases.

One of the problems people have with XP is pair programming. This is because it is different. Developers have a strange ownership issue when it comes to code, and XP tries to break that trend. Remember, the code is written to be rewritten, especially if the refactoring rule is upheld. Therefore, it should be natural for two people to work on the same module. Also, having two people per module will make the system better, because it is built using collaboration. Obviously, only one person can type at a single moment, but more thinking is involved during coding than in actual typing. When developers are having issues with a particular implementation, they have an extra brain to utilize. In addition, two developers are more likely to capture issues and voice concerns to each other, whereas single developers tend to make an educated guess and move forward.

The final component during the coding phase of XP is ensuring no overtime. Several articles have been written about the effects of overtime on a project. Using overtime to complete a project's task tends to tire the team and leave them more prone to making mistakes. Overtime brings down overall moral and provides little if any benefit to the final release. XP provides a mechanism by which to communicate with the customer. Instead of forcing overtime on the team, the release plan should be modified or the scope should be reduced for the current iteration.

Testing
Testing in the XP methodology is one of the main things that sets it apart from other methodologies. Of course, all methodologies require the testing phase. In XP, however, the team thinks about testing from the beginning straight through to the end of the system life cycle. Tests should be automated and included with the actual code. Testing should be completed before the code is integrated and test suites should be created that test all classes and methods within the entire system. The automation of testing is critical because as the system date approaches, manual tests will be cut short. By implementing testing automation, all tests can be replicated and regression testing can be completed quickly and easily in the maintenance phase of the system. By requiring that all code pass all tests before it is implemented, the development team is ensuring a higher-quality product. Any bugs found during testing should become additional unit tests. Another key difference in testing is that acceptance testing scores should be published. This enables a higher level of quality assurance. The customer will have the ability to review the test results and prioritize the issues found during testing.

More Stories By Troy Holmes

My name is Troy Holmes, I live in Northern Virginia. I have been working in the IT industry for 14 years currently working as a J2EE architect using Websphere 5.0. I have completed several large scale J2EE applications using both BEA and WebSphere. I am a certified Java Programmer, currently preparing for SCWCD and SCJA. I have been working in the java environment for 5 years. I am proficient in Java, C++, Power builder, VB, Unix Shell. I have more then 5 years experience in Oracle and 2 years experience in Informix. My professional background ranges from System Administrator to System Architect.

Comments (19) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
James Nwaba 07/17/08 06:38:46 AM EDT

This is a nice article - very straight froward, easy to understand.However, there was no mention of any organization that have implemented XP.
The author said, "Many of the concepts found in this lightweight method of development have been implemented into the software shops without even the awareness that they were XP techniques" Can you give examples of companies/organizations that are using or has used XP?

Dave Rooney 03/10/05 05:46:43 AM EST

First off, I agree completely with the comments that XP wasn't "one of the first iterative" processes. For a good history of iterative development, have a look at the article from Craig Larman and Vic Basili at:

http://www2.umassd.edu/SWPI/xp/articles/r6047.pdf

Secondly, my background is in business systems which likely has an influence on my views about agile development and XP.

] In 1-2-3 how XP is different from Rational Unified Process (RUP)?

1) XP focuses on one main artifact - the executable software that actually delivers business value to the Customer.

2) Testing at all levels is formalized into the process, and various frameworks are freely available.

3) For the price of one seat of Rational Enterprise Suite, you can buy a pretty big pile of index cards! ;)

] So, IMHO, what XP actually has introduced are 2 things:
]-1- pair programming -2- daily meetings

No one has ever said that the XP practices are new in an of themselves. The process originated when Beck looked at all the things that had worked for him over the years, and he figured a way to put them together. The end result is greater than the sum of its parts. BTW, Daily Stand-up Meetings came from Scrum.

] Phases of XP ------------ Planning - User stories,...

Those aren't phases. Planning in XP happens on a continual basis. By using short iterations (1-3 weeks), you're able to react to changes (which always occur) very quickly.

] Consultants and business analysts should damn well do
] their jobs and get workable specifications from customers,
] it's cheaper and more maintainable overall to develop a
] flexible, well formed design than to rush out brittle,
] naive XP code and try to understand/refactor the mess,
] at much greater cost later on.

Please define a workable specification. I agree completely that a flexible, well-formed design is cheaper and more maintainable, provided that it isn't speculative. The whole point of refactoring is to move the code base towards being cleaner and more maintainable long before it is shipped to production. The refactoring process happens in minutes, hours and days, and much less frequently in months or years.

Note as well that I advocate doing design work. I do not think that attempting to design the entire system in detail up front is valuable. However, my current team does whiteboard sessions constantly to work out design issues. We also work constantly with the Customer to work out requirment issues, since our system encompasses several lines of business.

We have been using XP on this particular project for 2 years, and we're pushing releases out to production every 3-4 months. I personally have been using XP for 4 years, and I can't imagine using another process. I'm also pragmatic about applying it - sometimes pair programming simply can't be sold. OK, then we'll do formal code reviews, and pair in a less formal way when we need help. One thing I have insisted upon is unit testing - there is simply no excuse for not doing it. Everyone pays lip service to automated unit testing, but very few people actually do. Fortunately, that number would appear to be growing.

] IMHO a consistent logging stragegy and self checking
] code are far more valuable than unit tests...

I log too, and find it valuable. Now, though, writing code without unit tests feels like being on a trapeze without a net.

] I like pre-release testing too, however I prefer to input
] real user data rather than contrived data since real users
] are much more creative at accidently or deliberately
] breaking a system e.g. scanning bar codes as money
] amounts!

Absolutely!! We do this as often as possible, and have 3 dedicated QA people who test our system. There is no substitute for actual use of the system to provide the feedback necessary to deliver a good product. There's nothing in XP that says you shouldn't do that!

As for XP at Chrysler, I don't know enough about it to comment. I do know about XP at the places I've applied it, and it has been successful.

Infernoz 03/06/05 05:56:55 PM EST

Agreed classic XP sucks.

As I think they say in XP (ironically), if something 'stinks' it probably needs refactoring e.g. pair programming, frequent unit testing *, frequent refactoring, customer representative on-site, no real design etc...

* BTW how do you test the test cases and is this recursive? What about the test case development cost, including extra test case costs, from refactoring?

Consultants and business analysts should damn well do their jobs and get workable specifications from customers, it's cheaper and more maintainable overall to develop a flexible, well formed design than to rush out brittle, naive XP code and try to understand/refactor the mess, at much greater cost later on.

I like pre-release testing too, however I prefer to input real user data rather than contrived data since real users are much more creative at accidently or deliberately breaking a system e.g. scanning bar codes as money amounts!

IMHO a consistent logging stragegy and self checking code are far more valuable than unit tests, since they are also valuable for catching and rapidly locating live issues e.g. I've even spotted rare, unreproduceable data bugs in other systems with this approach, so proving my software was OK!

BTW I use log4j, with a custom wrapper class, to enforce logging consistency, but haven't upgraded to the latest version because of the stupid new Level class change.

Jack C. Holt 03/04/05 10:36:23 AM EST

I have chime in here:

Not knowing much about XP up to a couple of days ago when I read this article, I was excited but wary about its principles. However, I have new found a wonderful and utterly readable book that has brought me back to my senses. It is called "Extreme Programming Refactored: the Case Against XP", by Matt Stephens and Doug Rosenberg from Apress (http://www.softwarereality.com/ExtremeProgrammingRefactored.jsp).

It does a wonderful job of analyzing XP's shortcomings and why they are shortcomings. I am an avid proponent of automated testing and am constantly searching for ways to improve customer/developer communication and lessen the onerous weight of written design documents, but almost anything to an extreme can cause problems. Even water will kill if drunk constantly!

Deke G. 03/02/05 11:41:36 AM EST

The Chrysler debacle is held up by XP proponents as a shining example of why XP works. However, the project was cancelled by Chrysler in February 2000 because it wasn't delivering - it was a payroll system that was only paying about 1/3 of the employees. XP itself says, "At the end of the day, if the program doesn't run and make money for the client, you haven't done anything." Chrysler decided they hadn't done anything. Ask an XP proponent about that failure, and you'll get a lot of spiritual-sounding mumbo-jumbo and trite phrases. One good one is from Beck himself: "XP is an emotional experience." Thanks, but I have a life outside work to provide my emotional experiences. I've read a lot on XP from people on both sides of the argument, and I've noticed that XP's proponents use much more spin and hype than its opponents. Here are some references for why you shouldn't believe everything you read about XP. Unfortunately, the first one is both the best and, I believe, only available to subscribers of CFDJ:
http://www.sys-con.com/story/?storyid=46792
http://members.cox.net/cobbler/XPDangers.htm
http://www.wired.com/wired/archive/11.09/xmen_pr.html

Gregory Smith 03/01/05 10:17:16 AM EST

Mostly good article - except ... "XP is one of the few methodologies that actually strives to deliver high quality code that meets the customer's expectations"

I cannot think of one software methodology that makes a contrary claim. Don't all methodologies of note that strives to deliver high quality code and meet the customer's expectations? Otherwise, is it even a viable methodology? Can anyone name a serious methodology that looks to skip either quality or customer satisfaction?

pat 02/25/05 10:54:47 PM EST

One more thing: I am *not* directing the comments above to the author, but rather to the editors who chose to publish this fine, if outdated article.

pat 02/25/05 07:22:10 AM EST

Please, not another article rehashing the same, tired old XP sales pitch. As one commenter said, this would have been novel four years ago. What are we going to have next, another article about JUnit? While this was written well enough, it does not provide a balanced view of the pro *and* the cons of XP and where it is and is not applicable. Anyway, XP and JUnit seem to be two topics that people write about when they have nothing else important to say.

mARK 02/21/05 01:45:22 PM EST

Methodology is the study of methods. XP is a development *method*.

Steve 02/18/05 12:12:33 PM EST

I struggle with XP. When it first came out it rubbed me completely the wrong way. I read a number of articles and Becks small book entitled "Extreme Programming Explained". A few years later, and based on my more traditional view of structured analysis and development, I find one thing true: do what works for you. In my humble but deadly accurate opinion Use Cases (and "Use" is not short for "Usability" I would like to clarrify) and UML ar the most helpful and misunderstood tools of the trade today and I highly recommend that programmers just slow down enough to strap on those well honed tools. Having said that, the reason XP doesn't really work is two "reality based" fundamentals:

1. Companies sponsoring projects are looking to contain cost. This is a large downfall of XP since based on it's vague (by nature) requirements you end up unable to nail down costs. The corporate world is demanding fixed bidding every day and the interrative style of gathering and defining requirements keeps the cost related to actual work tasks unreasonably fluid.
2. I watched an entire local consulting company collapse due to the implementation of a version of "XP". Reason: If I pay you for "XYZ" then I don't want to sacrefic "X" because you didn't understand the girth of "YZ" when we started. What would you do if you went to buy a car for $X and in the end $X only got you the tires you are looking for? You would want your money back and try to find a dealer willing to listen up-front before you sign-off on the bottom-line. Nobody likes sacrefic. Nailing down requirements and scope is difficult. The answer is not disguising that short fall with a process that accomodates it.

I realize these are heated-sounding comments - but my hope is that people get inspired to tell stories that prove me wrong.

My proposal: Learn UML, Document your project's analytical phases well, come to a team agreement on Quality, Cost and time and STICK TO THE PLAN!

If you are looking for something more flexible and interrative then examine the Proj. Management Guide to the Body Of Knowledge (PMBOK) cyclical models. You will find what you are looking for.

If you want to see an explanation of that - take a look at my cyclical process ( http://www.enginpost.com/resume/Pro%20CDP.pdf )!

Good luck everyone and happy coding!

Sridhar Pandurangiah 02/16/05 01:32:44 AM EST

Dave,

There is no harm in developers writing user stories but its better the users write it themselves, because this helps them crystalise their thoughts and precisely state the problem that needs to be addressed.

Regards,

Sridhar Pandurangiah

Oleg Kirshon 02/15/05 03:59:31 PM EST

Sridhar,

First, I'd like to thank you for addressing precisely what I was asking. I appreciate your digest, specific and from what I know - full answer.

From my observations on how UML appeared and matured as a methodology (engineering culture) an effort that RUP had undertaken was to give a perspective on how to use UML in practice. RUP and UML both have mutual references and one supports the other.

An Actor as a UML entity is present to facilitate the fact that Events in the system being initiated in a timeline. Further, statefull classes rely on Events as a vehicle that drives Class through it's lifecycle from State to State. Actor often present in Sequence diagrams.

Most importantly, RUP introduced the concepts of iteration and incrementation as guiding principles of the project process.

Once again, I agree with your comment that RUP is a commercial product that means marketing had influenced the expression of engineering experience and ideas. Though, I seek for agreement, the influence was not deadly.

In most of the responses to the discussion, and if I'm not mistaken, the comments made relate to the subject of how to bring Business Requirements (let's just name it as such in a very broad meaning of it) into the Engineering Environment. In other words, how to adequately express business needs in engineering terms.

Not a trivial task indeed, and I hope again to find agreement that generally speaking the same business needs may have substantially more then a single engineering perspective.

There we have flavors in approach and various success \ failure outcome.

Undeniably, I'd like to refer to comment Eduard makes, in my mind the decisive factor in the end always is the actual team you have to lead in a project as team members are irrational in their nature no matter what rational (or XP) methodology you attempt to go with. To me it's like tools, machinery and whom did you put to use it.

Both RUP and XP are, in my mind, an attempts to formalize the project as a process, yet delivering a project would still be an art of navigating it through.

The strong point made in XP is the timing of writing Test or Usability Cases (not always necessarily interpreted as identical). RUP shies away from it, while UML and OOAD folks stress the vital effect of Use Cases complemented by Usability Cases which is an Instance of Use Case in some UML interpretations.

Overall, I'd like to mention, I've seen businesses spending $mils on all Rational Corp had to offer with little engineering benefit. Quite similar to what happened with J2EE products. Naturally, we see a light-weight alternatives as APM (Apache/MySql/PHP etc.) and XP filling the niche.

Often frustrated by heavy duty monsters that RUP and J2EE / .NET are on one hand and pressed by the reality of succeeding in market place accompanied by a sense that there should be a way of producing better results with lesser overhead - in one word, a way to be substantially more efficient - engineering community finds ways and turns to alternatives with a promise as XP in my mind definitely is.

---------------------------------------------------------
Sridhar:

In UP you write the code and then test it.

There is no pair programming in UP, XP recommends pair programming
---------------------------------------------------------

That is true. Though as one open-minded follows RUP delivering project inevitably both do occur implicitly as XP suggests.

Quite similarly as people have been driving their projects incrementally through iterations before RUP mentioned it.

Eduard,

---------------------------------------------------------
So, IMHO, what XP actually has introduced are 2 things:
-1- pair programming
-2- daily meetings
Both are social aspects, and it was not possible to convince anyone of their benefits to the development process.
---------------------------------------------------------

---------------------------------------------------------
we used to write the user's manual one step ahead of design and coding we
always fulfilled the customer's expectations.
---------------------------------------------------------

That is, in my mind, a different viable perspective on how practically present Business Requirements, Concepts in Engineering perspective. RUP does identifies the focus area, except I was never taking the Inception literally. Once again, just as your team is a subject to a social aspect, so is the team of Business Analysts you work with.

Deke G

---------------------------------------------------------
Around my company, nobody mentions XP if they want to be taken seriously.
---------------------------------------------------------

To my believe, in environment where engineering culture is present, people are always open to see new tools and ways regardless of marketing label. Methodology, unless I'm mistaken, is a kind of a tool.

Thank you all.

Gratefully,

Oleg Kirshon

Sanmao 02/15/05 09:19:25 AM EST

The topic is very limited, current trends for software engineering is towards the 'Agile', but not 'why XP'. XP is one of agile ways. If you talk this topic 4 years ago, might be the perfect timing. I'd rather read an article 'Why Agile?'.

Lieven Doclo 02/15/05 08:00:51 AM EST

XP discredited because of Chrysler? One of the examples of how XP could be used to save a project WAS Chrysler, or so I have read...
http://www.xprogramming.com/publications/dc9810cs.pdf

Deke G. 02/15/05 06:24:40 AM EST

I thought XP had been thoroughly discredited following the Chrysler debacle. Around my company, nobody mentions XP if they want to be taken seriously.

Eduard Lukschandl 02/15/05 04:28:24 AM EST

I have been practising a method I call RAPID (RApid Prototyping and Incremental Development) since the early eighties and as we used to write the user´s manual one step ahead of design and coding we always fulfilled the customer´s expectations.

So, IMHO, what XP actually has introduced are 2 things:
-1- pair programming
-2- daily meetings
Both are social aspects, and it was not possible to convince anyone of their benefits to the development process.
I remember a study made by IBM in the late seventies about the importance of the social aspects when assigning a team for a development project. My conclusion was, and later experience confirmed, that it is not easy to get a bunch of notoriously individualistic programmers to work together much more than through interfaces.
(One could compare pair-programming with pair-painting. What might the pair Picasso-Dali have come up with?)

As to the testing method I consider it to be the result of general independent tool development that started with automated GUI testing many years ago.
The following link leads to a very interesting discussion titled "Are Tests First Class Clients?" illuminating some problems with test-driven development:
http://www.artima.com/forums/flat.jsp?forum=106&thread=90486
(Of course, XP cannot be made responsible for these.)

Concluding, I have a question:
What is XP´s answer to the top-down versus bottom-up question in software development?

Dave Conner 02/15/05 12:28:29 AM EST

Good and insightful summary - thanks. I've read quite a few articles on XP and other modern methodolgies, and yours was among the best organized...I was about to cancel my subscription to JDJ, but I might read it again.

I had a quick question - would you say that users always write user stories? We've had projects where developers wrote stories while interviewing customers... this technique seems to work pretty well.

Sridhar Pandurangiah 02/14/05 10:59:56 PM EST

Oleg,

To answer your question I should first mention that RUP the Rational Unified Process is a product. It is shipped along with the Rational Suite and is a set of process,artifacts and guidelines based on UP. It is UP or Unified Process that is the Process.

UP is different from XP in several ways. I'll mention a few of them
1. There are no daily stand up meetings
2. The concept of actors in UP is not found in XP
3. In XP code is written to pass a pre defined set of test cases. In UP you write the code and then test it.
4. There is no pair programming in UP, XP recommends pair programming

Phases of XP
------------
Planning - User stories, release plan, small release, measure velocity, iterate, plan iteration, move people, stand up meeting, Fix XP
Designing - System metaphor, CRC cards, Spike solutions, Refactor
Coding - unit test, pair program, integrate often, colletive code ownership, optimise
Testing - unit test, publish score

Phases of UP -
-------------
There are four phases - Inception, Eloboration, Consruction and Transition

Each phase can have several iterations 1, 2, so on

Each iteration can have the following activities
Project Management
Business Modelling
Requiremnets
Analysis and Design
Implementation (Actually means Coding)
Test
Configuration and Change management

Oleg Kirshon 02/14/05 09:37:49 PM EST

So,

In 1-2-3 how XP is different from Rational Unified Process (RUP)?