दुर्गा बेरागी Durga Beragi, homeEnter the study →

Library › Software and engineering

Extreme Programming Explained

Kent Beck · 1999 · Addison-Wesley

Short cycles, tests first, constant feedback.

About the book

Kent Beck published Extreme Programming Explained in 1999. It presents Extreme Programming, or XP, a lightweight method for small teams building software under changing requirements. Beck developed it on projects including the Chrysler Comprehensive Compensation payroll system. The first edition sets out the problem, the solution and how to put XP into practice. It names four values: communication, simplicity, feedback and courage. From these it derives practices such as the planning game, small releases, simple design, testing, refactoring, pair programming, collective ownership, continuous integration, a forty-hour week, an on-site customer and coding standards. A second edition in 2004, written with Cynthia Andres, added respect as a value and reorganised the practices.

Key ideas

  • The cost of changing software need not rise steeply over time. Beck argues that with tests, simple design and refactoring, change can stay cheap, so teams can delay decisions.
  • Short feedback loops at every scale reduce risk. Tests run in minutes, code is integrated within hours, iterations last weeks, and releases reach real users within months.
  • Tests come first. Programmers write automated unit tests before or alongside the code, and customers define acceptance tests, so the system's behaviour is checked continuously as it grows.
  • Design should be the simplest that works for today's needs. Teams avoid building for imagined future requirements and instead refactor the design when real needs actually appear.
  • The practices support each other. Pair programming, collective ownership, continuous integration and coding standards are weak alone but strong together, because each one covers the risks of another.
  • Sustainable pace matters. Tired programmers make more mistakes and produce worse designs, so XP limits overtime and treats a regular working week as part of the method itself.

Why it is on this shelf

Testing first, continuous integration and short release cycles are now normal, and this is where many of them were argued for. For a small team shipping often, the book explains the reasons behind the habits. It is short and states its assumptions openly.

How to start reading it

Read the first edition's chapters on the four values and the practices, then the chapter on how the practices support each other. Read the second edition later to see how Beck revised his thinking.

About this book

Extreme Programming Explained is a short book by Kent Beck, published by Addison-Wesley in 1999 with the subtitle Embrace Change. It introduced a method of software development that Beck and a few colleagues had been shaping through the 1990s and had used on real projects. The name was chosen to provoke. The idea was to take practices that programmers already knew were good, such as testing, code review and frequent integration, and turn each of them up as far as it would go.

The book is not a manual in the usual sense. It does not lay out forms to fill in or roles to staff. It is an argument: a statement of a problem, a set of values meant to address it, and a set of practices that follow from the values. Beck wrote it in a personal, direct voice, with short chapters, and he was open about his assumptions and the conditions under which the method was meant to work.

The problem it sets out to address is the basic risk of software projects. Projects run late. They are cancelled. The system that ships has too many defects, or solves the wrong problem, or solves a problem the business no longer has. Good programmers leave. Each of these failures, Beck argues, is a failure to deal with change. Requirements change, the business changes, the team's understanding of the problem changes, and the usual methods of the time treated change as an enemy to be prevented by careful planning up front.

Beck's proposal was the opposite. Accept that change will happen, and organise everything so that change is cheap. Work in very short cycles. Get feedback constantly, from tests, from the code itself, from customers and from the team. Keep the design as simple as today's needs allow, and improve it continuously. Make the whole team, including the customer, responsible together.

The intended reader was mixed: programmers who were tired of methods that did not match their experience, managers who wanted projects to stop failing, and customers who were tired of paying for systems that arrived late and wrong. The book's brevity was part of its appeal. It could be read in a weekend and argued about on Monday.

A second edition, written with Cynthia Andres and published in 2004, reworked the book substantially. It kept the spirit but changed the structure and some of the content, adding a fifth value and reorganising the practices. This study edition concentrates on the first edition, since that is the book that made the argument and changed the field, and it notes the main revisions where they matter.

The author

Kent Beck grew up in the United States, studied computer science at the University of Oregon, and came into professional programming in the 1980s. Much of his early work was in Smalltalk, a language whose live, interactive environment encouraged programmers to make small changes and see results at once. Many habits that later appear in Extreme Programming are already visible in how good Smalltalk programmers worked.

At Tektronix in the 1980s, Beck worked with Ward Cunningham, and the partnership shaped much of what followed. Together they developed CRC cards, a simple technique for designing object-oriented systems with index cards that name a class, its responsibilities and its collaborators. They also presented early work on applying the architect Christopher Alexander's idea of pattern languages to software, which fed into the patterns movement that produced Design Patterns, a book on this same shelf. Cunningham went on to invent the wiki, and the first wiki was used heavily to discuss patterns and, later, Extreme Programming itself.

Beck also built testing tools. He wrote a small unit testing framework for Smalltalk, and later, with Erich Gamma, created JUnit for Java. JUnit spread widely and inspired a whole family of similar frameworks for other languages. Its spread did as much as any book to make automated unit testing a normal part of programming.

The project most associated with the birth of Extreme Programming is the Chrysler Comprehensive Compensation system, a payroll project known as C3. Beck was brought in around 1996 when the project was in difficulty and reorganised the work along the lines that became XP. Ron Jeffries joined as a coach. The project put a first version into production, and it became the standard story told about the method. It was later cancelled, which critics have often pointed out; supporters reply that the cancellation reflected business decisions as much as the method. The fair view is that C3 shows the method could be run on a real system, not that it proves the method always succeeds.

After this book, Beck wrote Planning Extreme Programming with Martin Fowler, and Test-Driven Development: By Example, which focused on the practice of writing tests before code. He was among the people who met in 2001 and wrote the Manifesto for Agile Software Development. Later books include Implementation Patterns and, much later, Tidy First?, which returned to the economics of small design improvements. Through all of it runs one theme: software development is a human activity, and methods should fit people rather than the other way round.

The shape of the argument

The first edition moves in three broad parts, and its logic matters more than its order. It begins by stating a problem, moves to a proposed solution built up from values to practices, and ends with practical matters of adopting the method and knowing when not to.

From problem to economics

The opening part frames software development in terms of risk and economics. Beck argues that the value of a project depends not only on what it delivers but on the options it keeps open. A team that can change direction cheaply holds something valuable even if it never uses that ability. He introduces four variables that any project can control: cost, time, quality and scope. His claim is that outsiders may choose three of these but the team must be free to set the fourth, and that scope is the one that should usually give way.

He then makes a central claim about the cost of change. Received wisdom held that the cost of fixing a problem rises steeply the later it is found, so that a mistake caught in requirements is cheap and the same mistake caught in production is ruinous. Beck argues that this steep rise is not a law of nature. With the right technical practices, the curve can be made to flatten out, so that a change late in a project costs not much more than the same change early. If that is true, the logic of heavy up-front planning collapses.

From values to practices

The middle part builds the method in layers. First come four values: communication, simplicity, feedback and courage. Then a set of principles that translate the values into more concrete guidance. Then the basic activities of development: coding, testing, listening and designing. And finally twelve practices that are the visible face of XP.

Beck is explicit that the practices are not independent. Each one is weak or even dangerous on its own, and each covers for weaknesses in the others. Simple design without refactoring leaves a system unable to grow. Refactoring without tests is reckless. Collective ownership without coding standards and pair programming produces chaos. The method is a web, and much of the book's middle is spent showing how the threads support each other.

From theory to adoption

The last part deals with practice: how to introduce XP to a team, what management looks like, how facilities and roles change, and, unusually, when the method should not be used. Beck names conditions in which he believed XP would fail, such as very large teams, cultures that reward long hours as proof of commitment, or technologies that make feedback slow. This candour is part of what made the book trusted.

The argument as a whole has the structure of a proof sketch. If change can be made cheap, then decisions can be deferred until more is known. If decisions can be deferred, then the team should invest in practices that keep change cheap. Those practices form a mutually supporting set. Therefore a team that adopts them together can deliver valuable software under changing requirements. The weak link, as critics have noted, is the first premise, and the book's whole case leans on it.

Change can stay cheap

The idea at the root of the book is that the cost of changing software need not grow without limit as a project ages. Everything else follows from it.

The older picture came from studies of large projects in the 1970s and 1980s, associated especially with Barry Boehm, which found that defects were far more expensive to fix after release than during design. The lesson drawn from those studies was to invest heavily in getting requirements and design right before writing code. Specifications, reviews, sign-offs and change control boards all served this goal. Change was treated as a cost to be minimised.

Beck does not deny the old data. He argues that it described projects run in a particular way: with long phases, late testing and code that had never been designed to change. In such projects, a late change means touching code nobody has looked at for months, with no tests to say whether anything else broke. Of course it is expensive.

His claim is that a different way of working changes the curve. If every piece of code is covered by automated tests that run in minutes, then a change can be checked at once. If the design is kept simple, there is less to understand before making a change. If the code is improved continuously, it stays in a state where changes are easy. If the whole team knows the whole code, nobody is stuck waiting for the one person who understands a module. Under these conditions, Beck argues, a change late in the project costs only somewhat more than early on.

A useful analogy is a garden. A garden left untended for a year is hard to change: weeds have rooted, paths have vanished, and every new bed means hours of clearing. A garden tended for twenty minutes every day is always easy to change. You can add a bed or move a path in an afternoon. The cost of change depends less on the age of the garden than on how it has been kept.

The idea is often confused with a claim that planning does not matter. Beck's point is about timing. If change is cheap, then planning can be done in small amounts, close to when it is needed, using the best information available at that moment. If change is expensive, planning has to be done early, with poor information, because mistakes cannot be corrected later. XP plans constantly, but in small pieces.

The idea leads to a view of software decisions as options in the financial sense. An option is the right, but not the obligation, to do something later. Options have value because the future is uncertain. A team that can cheaply defer a decision holds an option, and each week it learns more about which choice is right. Beck draws on this way of thinking explicitly, and it remains one of the most useful lenses the book offers.

Four variables and the trade in scope

Early in the book Beck offers a simple model of what any project can control. There are four quantities: cost, time, quality and scope. Cost is what is spent, mostly on people and equipment. Time is when the system must be delivered. Quality is how correct, robust and maintainable it is. Scope is how much it does.

His first point is that these are linked. Push one and the others move. A fixed deadline with a fixed budget and a fixed list of features leaves only quality free, and quality is what suffers, often invisibly at first. Teams then deliver something that appears to meet the brief but is riddled with defects that surface later at great cost.

His second point is about who decides. Customers and managers may fix some of the variables, but not all four. The team must be allowed to tell them what the remaining one turns out to be. If the business fixes cost, time and quality, then scope must be the free variable, and the team will report honestly how much can be built within the others.

Beck argues that scope is the best variable to leave free, for two reasons. First, quality should not be traded away, since its loss poisons everything after; he argues that teams in fact work better when held to high quality, because pride in work is a strong motivator. Second, scope is the variable about which the customer knows least at the start. Many requested features turn out to matter little once the system is in use, and others that nobody thought of turn out to be essential. Leaving scope open lets the project learn.

An analogy is packing for a long trip with a fixed suitcase and a fixed departure time. You cannot make the suitcase bigger or the clock slower, and packing badly so that things break is no answer. What you can change is what goes in. Sensible travellers put the essentials in first, then add what fits. XP plans in the same way: the most valuable stories first, so that whatever the final scope turns out to be, it contains the things that matter most.

This is often confused with a refusal to commit. A team using XP does commit, iteration by iteration, to specific stories it has estimated. What it does not do is promise a fixed, detailed list of everything that will be done months ahead. In practice, customers who have worked this way often prefer it, because they see working software early and can change their minds about priorities as they learn.

Four values

XP rests on four values, and Beck argues that a method must start from values because practices alone cannot cover every situation. When a team meets a problem the practices do not address, it needs a shared sense of what matters to decide what to do.

Communication

Most project problems, Beck observes, can be traced to someone not telling someone else something important. A programmer does not mention a design change. A customer does not explain a priority. A manager does not ask the question that would have revealed a problem. XP's practices are designed to force communication: programmers work in pairs, the customer sits with the team, the code is owned by everyone, and progress is tracked openly.

Simplicity

The value of simplicity asks a team to do the simplest thing that could possibly work for the needs of today, and to trust that it can add complexity later if needed. This is a bet. It bets that the cost of adding something later is lower than the cost of building it now and carrying it, unused, in the meantime. Since predictions about future needs are often wrong, the bet usually pays.

Feedback

Feedback in XP runs at every scale. Within minutes, tests tell a programmer whether the code works. Within hours, integration tells the team whether the pieces fit. Within days, the customer sees new features. Within weeks, releases tell the business whether the system is doing its job. Each loop catches different kinds of mistake, and each loop is kept as short as possible.

Courage

Courage is the strangest of the four, and Beck includes it deliberately. It takes courage to throw away code that does not work, to make a large change to a design that has turned out wrong, to tell a customer that a deadline cannot be met with the current scope. The other values make courage safer: with tests and simple code, a bold change is less likely to cause disaster. But the value has to be named, because teams under pressure tend to choose timid options that feel safe and make things worse.

The values together

The four values reinforce each other in a cycle. Communication supports simplicity, because a team that talks can agree on the simplest solution. Simplicity supports feedback, because simple systems are easier to test. Feedback supports courage, because quick confirmation makes bold moves less risky. Courage supports communication, because it takes courage to raise uncomfortable truths. In the second edition, Beck added respect as a fifth value underlying the others: members of a team must care about each other and about the project for any of this to work.

The values are often mistaken for slogans. Their role is more practical. When a team argues about whether to adopt a new tool, add a document or hold a meeting, the values give a test: does it improve communication, simplicity, feedback or courage, and at what cost to the others?

Principles and the basic activities

Between the values and the practices, the first edition places two further layers. The values are too general to guide daily decisions, and the practices are too specific to cover every case. Principles and basic activities fill the gap.

Principles

Beck lists a handful of fundamental principles that turn the values into tests one can apply. Among them are rapid feedback, assuming simplicity, incremental change, embracing change and quality work. Several more secondary principles follow, such as teaching learning, small initial investment, playing to win, concrete experiments, open and honest communication, working with people's instincts rather than against them, accepted responsibility, local adaptation, travelling light and honest measurement.

The value of these principles lies in their use as checks. Suppose a team is considering a detailed design document for a new subsystem. Does it give rapid feedback? Not much, since it describes intentions rather than tested behaviour. Does it assume simplicity? It may encourage designing for imagined needs. Is it a small initial investment? Usually not. The principles do not forbid the document, but they make its costs visible and suggest alternatives, such as a quick experiment in code.

The principle of accepted responsibility deserves special notice. In XP, work is not assigned by a manager and accepted under protest. Programmers sign up for tasks and estimate them themselves. Beck argues that people work better on commitments they have chosen. Responsibility imposed from above tends to be evaded; responsibility accepted tends to be honoured.

Basic activities

Beck then reduces development to four activities: coding, testing, listening and designing. Coding is where the system takes form and where ideas are tested against reality. Testing tells you when coding is finished and whether it still works. Listening is how programmers learn what the business needs, since they are not experts in the business. Designing is the creation of a structure that organises the logic of the system so that it can keep changing.

The point of this reduction is to strip away activities that do not serve these four directly. Many methods of the time asked for extensive documents, sign-offs and phase reviews. Beck does not say these are always useless, but he asks what each contributes to coding, testing, listening or designing. Activities that contribute little are candidates for removal. Travelling light, in the language of the principles, means carrying only what the journey requires.

Tests first

Testing is the practice that holds XP together. Without it, the other practices are dangerous. With it, they become possible.

XP asks for two kinds of tests. Programmers write unit tests for each part of the code they build, automated so that the whole suite can run in a short time. Customers, with help, define acceptance tests that describe what the system must do from their point of view. Both kinds of test are run constantly. A change that breaks a test is fixed at once.

Beck goes further than many methods of the time by asking programmers to write unit tests before the code they test. This sounds backwards, and many readers resisted it. The reasoning is that a test written first is a precise statement of what the code should do. Writing it forces the programmer to think about the interface and behaviour before the implementation. When the code is then written and the test passes, the programmer knows the task is done. And because the test exists from the start, it is never skipped for lack of time.

An analogy is a carpenter who cuts a template before making a set of identical pieces. The template takes time, but each piece can then be checked against it instantly, and a piece that does not fit is caught before it is assembled into a cabinet. The tests are the templates of the code.

Tests in XP are not only a quality check. They are a form of documentation, showing how each part of the system is meant to be used. They are a design tool, because code that is hard to test is usually code that is poorly structured. And above all they are a safety net that makes change cheap. A programmer who wants to improve a design can make the change and run the tests. If they pass, the change is safe. This is what makes refactoring, collective ownership and simple design practical.

The practice is often confused with traditional quality assurance, in which a separate team tests the software after it is built. XP does not forbid separate testers, but it moves the responsibility for basic correctness into the programming itself. Tests are part of the code, written by the people who write the code, and run every few minutes rather than at the end of a phase.

Beck later developed the practice into a full method, test-driven development, in which each small piece of functionality is built through a repeated cycle: write a failing test, make it pass in the simplest way, then clean up the code. That cycle has become one of the most influential ideas to come out of XP, and many programmers who have never heard of Extreme Programming use it.

Simple design and refactoring

XP asks for the simplest design that works for the features in hand, and for continuous improvement of that design as new features arrive. The two practices are inseparable.

Beck gives criteria for simple design that are worth remembering in substance. The code must pass all its tests. It must express every idea the programmers need it to express. It must say each thing once and only once, with no duplication. And within those constraints it must have as few parts as possible. The order matters: correctness first, then clarity, then removal of duplication, then economy.

The contrast is with designing for the future. Many programmers, trained to anticipate, build general frameworks, extension points and configurable layers in case they are needed later. Beck argues that most of these guesses are wrong, that the unused generality makes the code harder to understand and change, and that when the real need appears it is usually different from what was imagined. The XP principle often summarised as you are not going to need it captures this attitude.

Refactoring is what makes simple design survivable. If the design is only as rich as today's needs, then tomorrow's needs will often require a different design. Refactoring means changing the structure of code without changing its behaviour, in small, safe steps, each checked by the tests. When a new feature does not fit the current design, the team first refactors the design so that it does fit, then adds the feature.

An analogy is a house extended over generations. One family builds a small house that suits them. When children come, they add a room. When the children leave, they convert it to a workshop. A family that had tried to build for every future at the start would have built a mansion they could not afford and still would not have guessed the workshop. The house that grows, with walls moved as needed, ends up fitting better.

Martin Fowler's Refactoring, also on this shelf, is the book that catalogued the techniques. Beck contributed to it, and the two books are best read together. Refactoring without XP's tests is risky; XP without refactoring's techniques is vague about how to improve code safely.

The practice is often misread as a licence for no design at all. Beck's position is that design happens all the time, in small increments, rather than in a single phase at the start. A team practising XP well spends a large share of its effort on design, but that effort is spread across the whole project and informed by real experience of the code.

Two at one keyboard

Pair programming is the most visible and most resisted XP practice. All production code is written by two programmers sitting together at one computer. One types and thinks about the immediate task. The other watches, thinks about the larger picture, catches mistakes and suggests alternatives. They swap roles often, and pairs change partners frequently over the course of a project.

To an outsider this looks like paying two people to do one job. Beck's argument is that pairs produce better code at little extra cost, and in some cases no extra cost at all, because they make fewer errors, get stuck less often, stay focused and spread knowledge through the team. The pair is a continuous code review, conducted at the moment when fixing problems is cheapest.

An analogy is a rally car with a driver and a navigator. The driver handles the road immediately ahead. The navigator reads the route, warns of coming turns and notices when they have gone wrong. Neither could do both jobs as well alone at speed.

Pairing also serves communication. When pairs rotate, every programmer comes to know many parts of the system. New members learn the code by pairing with experienced ones. Good habits spread because people see each other work. And the team develops a shared sense of how the code should look.

Beck was candid that pairing is hard. It is tiring, it requires social skill, and some programmers find it intolerable. Later research gave mixed results: pairs generally produced fewer defects and better designs, and often finished sooner than one person, but used more total person-hours on simple tasks. The benefits seem greatest on complex work and for spreading knowledge.

The practice is often confused with two people sharing one job in a loose way, one working while the other rests. That is not pairing. Both people are engaged all the time, and the value comes from the dialogue between them. Many teams that rejected strict pairing kept its spirit in practices such as close code review and occasional pairing on hard problems.

Planning in small pieces

XP replaces a single large plan with continuous small planning, organised around what Beck called the planning game. The name signals that planning is an interaction with rules, between two parties with different responsibilities.

The business side, represented by the customer, decides what the system should do and in what order. It writes stories, short descriptions of features in terms of value to users, each written on a card. The technical side decides how long each story will take and what risks it carries. Neither side may make the other's decisions. The customer does not tell programmers how long something should take; the programmers do not tell the customer what is most important.

Plans are made at two scales. A release plan sets out roughly which stories will be in the next release, a few months away. An iteration plan, made every one to three weeks, picks the stories for the coming iteration and breaks them into tasks. At the end of each iteration, the team measures how much it actually completed and uses that to plan the next. This measured rate, later popularly called velocity, gives a plan grounded in evidence rather than hope.

Small releases follow from this. Beck asks teams to put a simple system into production early and then release new versions on a short cycle. Each release must make sense as a whole and deliver real value. The point is to start getting feedback from real use as soon as possible and to make sure that, if the project were stopped at any moment, the business would have something valuable.

An analogy is navigation by dead reckoning compared with navigation with frequent position fixes. A ship that plots its whole course at departure and never checks will drift far off by the end. A ship that fixes its position every few hours can correct as it goes. The XP plan is a course checked against reality at every iteration.

The approach is often confused with having no long-term plan. XP does have release plans and a sense of direction. What it refuses is the pretence that a detailed plan made at the start can survive contact with the work. It plans in detail only for the near future and in outline for the rest.

The whole team and shared code

Several XP practices concern who does what and who owns what. Together they describe a team in which boundaries between roles and between parts of the code are kept low.

The on-site customer

The first edition asks for a real customer, someone who will use the system or speaks with authority for those who will, to sit with the team full-time. This person writes stories, answers questions as they arise, writes acceptance tests and sets priorities. The reasoning is that most of the questions programmers have about requirements can be answered in seconds by the right person, but take days when they must go through documents and meetings. Many organisations found this hard to arrange, and later forms of the method softened it into a wider idea of a whole team with business knowledge present.

Collective ownership

Any programmer may change any part of the code at any time. There are no private modules. If a pair sees a way to improve code elsewhere, they improve it. This removes bottlenecks and means that knowledge of the code is not trapped in one head. It depends on the tests, which catch breakage, and on pairing and rotation, which spread understanding.

Coding standards

Because everyone works on everything, the code must look as if one person wrote it. The team agrees on conventions of naming, formatting and structure and follows them. This reduces friction when moving between parts of the code and makes collective ownership practical.

Metaphor

The first edition also asks the team to share a simple story or metaphor for how the system works, a common picture that guides naming and design. This was the least understood of the practices, and Beck largely dropped it in the second edition. Its intent, a shared vocabulary for the system, lived on in other forms, most fully in Domain-Driven Design, also on this shelf.

Continuous integration

Code is integrated into the shared codebase and tested many times a day, rather than in large merges at the end of long stretches. Each integration is small, so problems are found when they are easy to trace. This practice became one of the most widely adopted of all XP ideas, and today tools exist in almost every software organisation to run it automatically.

A sustainable pace

The first edition's practice list includes a forty-hour week. The second edition renamed the idea energized work. The principle is the same: programmers should work at a pace they can sustain indefinitely, and overtime should be rare.

Beck's argument is practical, not sentimental. Tired programmers make more mistakes, take worse decisions and write code that costs more to fix later. A week of overtime may produce more lines of code but often produces less value, once the defects are counted. Repeated overtime is a symptom of a planning failure, and the fix is to change the plan, not to push the people harder.

An analogy is a long-distance runner. A runner who sprints the first mile of a marathon does not finish faster. Pace is set by what can be held to the end. Software projects are long, and a team that burns itself out in the first months will crawl through the rest.

The practice also shows XP's view of programmers as people with lives, not resources to be consumed. Beck's later writing made this theme more explicit. The second edition's added value of respect, and principles such as humanity, gave the human side of the method a clearer place in its foundations.

This is often confused with a rule against ever working late. XP accepts that crunch moments occur. Its rule is that such moments should be exceptions, and that a second consecutive week of overtime is a warning sign that something in the project needs to change.

Practices that hold each other up

Perhaps the deepest idea in the book is not any single practice but the claim that the practices form a system. Beck spends considerable space showing how each weakness is covered by another practice. This is what makes XP more than a list of good habits.

Consider simple design alone. A team that builds only what it needs today will eventually find its design inadequate. That would be a fatal weakness, except that refactoring lets the design grow. Refactoring alone is risky, since every structural change might break something. Tests cover that risk. Tests alone might be neglected under pressure, but writing them first, and pairing, make neglect harder. Collective ownership alone could produce chaos, but coding standards, pairing and continuous integration keep everyone's changes compatible. Short iterations alone might lose direction, but the on-site customer and the planning game keep them aimed at value.

The analogy Beck himself invites is of a structure in which each member is weak alone but the whole is strong. A useful picture is a tent: no single pole or rope can hold it up, but together they make a stable shelter. Remove one rope and the tent may sag but stand. Remove several and it collapses.

This has an important consequence for adoption. Teams often adopt some XP practices and not others, and then report that XP failed. Beck's argument predicts exactly this. Short iterations without tests produce brittle code quickly. Collective ownership without pairing produces confusion. Simple design without refactoring produces a dead end. The practices were designed as a set, and their benefits depend on their combination.

At the same time, Beck recommends adopting XP gradually: pick the worst problem, apply the practice that addresses it, and see what happens. These two pieces of advice are in some tension. The resolution is that a team adopting XP piece by piece should know which other practices each new one depends on, and should expect partial benefits until the set is complete.

Roles, coaching and tracking

Although XP is often described in terms of programmers and customers, the first edition also names several supporting roles. They show how Beck expected a team to manage itself with a light touch.

The coach is responsible for the process as a whole. A coach watches how the team works, notices when practices slip, and intervenes with suggestions rather than orders. The coach is often an experienced programmer who pairs with others and teaches by example. Beck describes the ideal coach as someone who becomes less needed over time, as the team takes on the habits for itself.

The tracker gathers simple measurements: how many stories were finished, how estimates compared with actual effort, how many tests pass. The tracker reports these regularly and without blame. The purpose is honest feedback about progress, so that plans can be adjusted early. Beck warns against collecting more data than the team will use, since measurement has a cost and too much of it becomes noise.

Testers in XP help the customer write acceptance tests and run them. Consultants with special expertise may be brought in when the team lacks a skill, and are expected to teach rather than simply solve. Managers, sometimes called the big boss, provide resources, remove obstacles and hold the team to its commitments, but stay out of technical decisions.

An analogy is a small sailing crew. Everyone handles lines and takes the helm in turn, but one person keeps an eye on how the crew is working together, another keeps the log, and the owner decides where the boat is going without telling the crew how to trim the sails. Roles exist, but they are thin, and nobody's job is to issue orders on how others should do theirs.

This reflects a wider stance in the book. Beck trusts teams to manage much of their own work and builds feedback in so that problems show up early. Management in XP is less about control and more about keeping the conditions for good work in place.

Knowing when not to use it

Few books on method spend time on the conditions under which their own method should not be used. Beck does, and the passage is one of the most useful in the book, both for what it says about XP and for what it teaches about judging any method.

His warnings fall into a few kinds. The first concerns culture. If an organisation measures commitment by hours at the desk, or rewards people for heroic rescues rather than steady progress, XP's sustainable pace will look like laziness and will not survive. If a team must produce large documents to satisfy someone who will never read them, the method's lightness will be seen as negligence.

The second concerns size. XP depends on constant conversation among everyone on the team. Beyond a certain number of people, perhaps a dozen or so, that conversation breaks down. Beck did not claim that larger efforts are impossible, only that the method as described was built for small teams and would need to change to work at scale.

The third concerns technology and environment. If building and testing the system takes many hours, the short feedback loops on which everything rests cannot run. If the team is spread across distant sites, pairing and the on-site customer become hard. If the physical workspace isolates people in separate rooms, communication suffers. Each of these, Beck notes, can sometimes be fixed, and fixing it is often worth doing; but where it cannot, XP will struggle.

An analogy is a recipe that assumes a hot oven. The recipe may be excellent, but in a kitchen with a weak oven it will fail, and the failure says nothing about the recipe. A cook who reads the conditions first saves a wasted meal.

The wider lesson is that a method is a bundle of assumptions. Stating them openly lets readers judge whether those assumptions hold in their own situation. Methods that claim to work everywhere are usually hiding their assumptions, and teams that adopt them discover the assumptions only through failure. Beck's honesty here is one reason the book earned trust, and one reason it remains worth reading even by people who would never adopt XP whole.

What the second edition changed

The 2004 edition, written with Cynthia Andres, is close to a new book. It keeps the purpose and the spirit of the first but restructures the method and shifts its tone. Readers who meet both editions should know the main differences.

The values gained a fifth member, respect. The principles were made explicit and given a fuller treatment, with names such as humanity, economics, mutual benefit, self-similarity, improvement, diversity, reflection, flow, opportunity, redundancy, failure, quality, baby steps and accepted responsibility. Several of these, such as self-similarity, make explicit ideas that were implicit before: that the same pattern of short cycles should apply at every scale, from a few minutes to a quarter year.

The practices were reorganised into primary practices, which a team can adopt on their own with immediate benefit, and corollary practices, which depend on the primary ones being in place. The primary set includes sitting together, the whole team, an informative workspace, energized work, pair programming, stories, weekly and quarterly cycles, slack, a ten-minute build, continuous integration, test-first programming and incremental design. Metaphor disappeared as a named practice. The forty-hour week became energized work. The on-site customer was absorbed into the idea of a whole team.

The tone also changed. The first edition was confident and sometimes combative, written to persuade. The second is more reflective and more concerned with people, with relationships within teams and with the place of software work in a wider life. Beck had seen XP adopted, misapplied and argued over for five years, and the second edition reads like the work of someone who had learned from that.

Which edition to read first is a matter of purpose. The first is the historical document that launched the method and made the argument most sharply. The second is the more mature statement. Reading both, in order, shows a method evolving under the pressure of experience, which is itself in keeping with XP's own values.

The tradition around it

XP drew on several streams. The Smalltalk community's habits of small changes and constant testing were one. The patterns movement, which Beck helped start, was another; its concern with designs that grow organically from use echoed through XP. Older ideas about iterative and incremental development, which had existed in various forms since the 1960s, also lay behind it. Beck's contribution was to combine these into a method with a clear rationale and a memorable shape.

XP was one of several lightweight methods that appeared in the 1990s, alongside Scrum, Crystal, Feature-Driven Development and others. In 2001 practitioners of these methods met and wrote the Agile Manifesto, which gave them a shared name. XP was the most technically specific of them, the one most concerned with how code itself is written. Scrum, focused on project management, later became more widespread, but many teams that called themselves Scrum teams adopted XP's technical practices underneath.

On this shelf, The Psychology of Computer Programming by Gerald M. Weinberg anticipates XP's attention to human factors and its idea of code shared and reviewed among peers. Peopleware by Tom DeMarco and Timothy Lister makes the case for sustainable pace and for environments in which people can do good work. The Cathedral and the Bazaar by Eric S. Raymond, from the same year, argues for short release cycles and constant feedback from a very different setting, the open-source world of volunteers who never meet.

Refactoring by Martin Fowler is the technical companion to XP's practice of continuous design improvement. The Pragmatic Programmer by Andrew Hunt and David Thomas shares XP's emphasis on automation, testing and responsibility, written for the individual programmer rather than the team. Code Complete by Steve McConnell represents a more traditional, construction-focused view of programming and is a useful counterweight, especially on how careful design and review fit in.

Working Effectively with Legacy Code by Michael C. Feathers addresses a problem XP largely assumed away: how to get tests around existing code that was never written to be tested. Clean Code by Robert C. Martin carries forward XP's concern with readable, well-tested code. Domain-Driven Design by Eric Evans develops the idea of a shared language between programmers and the business, which XP's metaphor practice gestured toward. Site Reliability Engineering shows how feedback loops and automation scale to operating very large systems.

Later developments built directly on XP. Continuous delivery extended continuous integration all the way to production. The DevOps movement took the idea of short feedback loops across the boundary between development and operations. Test-driven development became a discipline of its own. Much of what is now ordinary practice in software teams can be traced, at least in part, to arguments first made in this book.

Questions and criticisms

The cost-of-change curve

The book's central premise, that change can be kept cheap throughout a project, was asserted more than demonstrated. Beck offered reasoning and experience, not systematic data. Some critics argued that the old curve still applies to many kinds of change, especially to architectural decisions, data formats and external interfaces, which are expensive to alter however good the tests. The fair reading is that XP flattens the curve for much ordinary change but not for all of it, and that some decisions still deserve thought up front.

Evidence from C3

The flagship project's cancellation was used against XP for years. A single project, successful or not, proves little either way. But the book's early case rested heavily on a small number of projects led by its own authors, and independent evidence came only later and remained mixed.

Scale and context

XP was designed for small, co-located teams of perhaps a dozen programmers. Beck said so. Applying it to large, distributed organisations required substantial changes, and many attempts to scale agile methods produced heavy frameworks that lost much of XP's original lightness. Teams spread across time zones found pairing and an on-site customer hard. Regulated industries needed documentation XP did not provide.

The on-site customer

Few organisations could supply a single empowered customer to sit with the team full-time. Where they did, the role was often exhausting for that person. Later practice spread the role across product managers, analysts and designers, which helped but also brought back some of the communication delays XP sought to remove.

Social demands

Pairing, collective ownership and constant communication suit some people better than others. Critics noted that XP could be hard on introverts and on people who think best alone. Beck acknowledged the difficulty but held that the benefits outweighed it; others disagreed. Many teams settled on a lighter mix.

What has held up

A great deal has held up. Automated unit testing, continuous integration, short iterations, frequent releases, incremental design and refactoring are now standard in much of the industry. The idea that technical practices and planning practices must fit together, rather than being chosen separately, is widely accepted. The insistence on sustainable pace remains more honoured in words than in deeds, but it is at least part of the vocabulary. The book's habit of stating its own assumptions and limits remains a model for writing about method.

Why it is on this shelf

This shelf holds books on Vedanta, Jyotish, science, economics and technology, and a theme running through all of them is how one acts well under uncertainty. Extreme Programming Explained is one of the clearest treatments of that question in a practical field.

Its core move, to stop trying to predict the future and instead arrange things so that adjusting to it is cheap, is an idea with wide reach. In economics, it is the logic of options and of keeping flexibility when information is poor. In science, it is the logic of small experiments and rapid correction. In disciplined personal practice of any kind, it is the logic of daily attention rather than occasional heroic effort. The book shows how that logic becomes concrete in the daily work of a team.

It is also a model of how to argue for a method. Beck begins with values, derives principles, then practices, and shows how the practices depend on each other. He states where the method should not be used. Few books on method in any field are so open about their reasoning.

For anyone who builds software, especially in small teams, it explains why habits now taken for granted were adopted and what they are for. Knowing the reasons lets a team adapt the habits sensibly instead of following them as ritual. For readers outside software, it is a short and readable case study in designing a system of practices that hold each other up.

We keep it in the software bay, beside the books on craft and on teams, as the most compact statement of the idea that good work comes from short cycles of action and feedback, carried out at a pace people can sustain.

How to read it

The first edition is short, and the best plan is to read it through quickly first, in two or three sittings, to get the whole argument. Do not stop to judge each practice on the first pass. The book's claim is about the system, and the system only becomes visible once you have seen all the parts.

On a second, slower pass, focus on three things. First, the chapters on the problem and its economics, especially the four variables and the cost-of-change argument. With a pencil, write down in your own words why Beck thinks the curve can be flattened, and what would have to be true for him to be wrong. Second, the values and principles. Third, the discussion of how the practices support each other. Draw it as a diagram: each practice as a box, with arrows to the practices that cover its weaknesses. This one exercise teaches more about XP than any other.

The chapters on adoption, management and facilities can be read more quickly. They are useful if you are actually introducing the method to a team, and less so otherwise. Do read the short discussion of when not to use XP; it is one of the book's best features.

If you write code, try test-first programming on a small exercise while reading. Write a test, make it pass, clean up the code, repeat. A few hours of this teaches more about the practice than any amount of description. If you can, try pairing with someone for a day.

Then read the second edition, with Cynthia Andres. Notice what Beck changed and ask why: the added value, the explicit principles, the split of practices into primary and corollary, the dropping of metaphor. The changes show a thoughtful author revising his own method in the light of five years of experience, and that is itself instructive.

From this shelf, read next Refactoring by Martin Fowler for the technique behind continuous design, then Working Effectively with Legacy Code for how to bring tests to code that has none. Peopleware deepens the human side, and The Cathedral and the Bazaar shows a parallel argument from the open-source world. Domain-Driven Design takes up the question of shared language where XP's metaphor left off.

Questions to carry

  • Which kinds of change in your own work are cheap, and which stay expensive no matter what you do?
  • If you could only adopt three XP practices, which would you choose, and which weaknesses would they leave uncovered?
  • What is the shortest feedback loop in your work today, and what is the longest?
  • When is building for the future wise rather than wasteful?
  • What would courage look like in a project that is going badly?
  • How do you know whether a design is simple in Beck's sense, rather than merely small?
  • Who in your project plays the role of the customer, and how long does it take to get an answer from them?
  • What does a team lose when it gives up private ownership of code, and what does it gain?
  • How would you tell whether overtime on your team is an exception or a habit?
  • Why might a method that works for twelve people fail for two hundred?
  • What would count as good evidence that XP works, and has such evidence been gathered?
  • How do the four values apply to work that has nothing to do with software?
  • Which XP practices have become so normal that their original purpose is forgotten?

Words to know

  • Extreme Programming (XP): a lightweight software development method built on short cycles, automated tests, simple design and close collaboration.
  • Iteration: a short fixed period, typically one to three weeks, at the end of which the team delivers working, tested features.
  • Release: a version of the system put into real use; XP aims for small, frequent releases.
  • Story: a short description of a feature in terms of value to users, written on a card and used for planning.
  • Planning game: XP's planning process, in which the business chooses scope and priority and programmers estimate cost and risk.
  • Velocity: the amount of work a team actually completes in an iteration, used to plan the next one.
  • Unit test: an automated test of a small piece of code, written and run by programmers.
  • Acceptance test: an automated test of a feature from the customer's point of view, defining when it is done.
  • Test-first programming: writing a test before the code that makes it pass.
  • Test-driven development: a disciplined cycle of writing a failing test, making it pass simply, then cleaning up the code.
  • Refactoring: changing the internal structure of code without changing its behaviour, in small safe steps.
  • Simple design: the simplest design that passes all tests, expresses every needed idea, has no duplication and has as few parts as possible.
  • Pair programming: two programmers working together at one computer on the same code.
  • Collective ownership: the practice that any team member may change any part of the code.
  • Continuous integration: merging and testing everyone's changes many times a day.
  • On-site customer: a person with authority over requirements who works full-time with the team.
  • Metaphor: in the first edition, a shared story describing how the system works, used to guide naming and design.
  • Sustainable pace: working hours that can be maintained indefinitely without loss of quality; first called the forty-hour week, later energized work.
  • Cost-of-change curve: the relationship between how late in a project a change is made and how much it costs.
  • Four variables: cost, time, quality and scope, the quantities a project can control.
  • Agile: the family of lightweight methods, including XP, whose practitioners wrote a shared manifesto in 2001.
  • You aren't going to need it: an XP maxim against building features or generality before they are actually required.

A note on this edition

This is a study edition written for this shelf in our own words. It describes and discusses Extreme Programming Explained but does not reproduce it, and it cannot replace reading Beck's own clear and personal account.

The book is in copyright. Both editions are available from libraries and bookshops, and both are worth reading. Any errors of fact or emphasis here are ours, and readers should check our account against the original.

More from “Software and engineering”

The whole section →