← back to the section

The team runs on Scrum: there's a sprint, there's a backlog, and every two weeks there's a demo. The process is in place, but releases are still scary. Every update risks breaking something, tests are run by hand before a rollout, and after merging a large branch half a day goes into untangling conflicts. The problem isn't the process — the process is actually fine. The problem is how the code is written: it isn't ready to change often and safely.

Extreme Programming (XP) is the methodology that closes exactly this gap. Scrum and Kanban answer the question "how do we organize the flow of work": who takes what, when we plan, how we show the result. XP answers a different question — "how do we write and change code so that fast iterations don't turn into an accumulation of problems." It's a set of engineering practices, not ceremonies. Let's break down what it consists of and why parts of this set became an industry standard long ago.

loop: red test → minimal code → green → cleanup test red code minimal cleanup green testred codeminimal cleanupgreen the check exists test is green same behavior next test pair: review while typing,not a day later in a pull request net of checks no more than halfred no more than halfgreen refund on cancelred no code yet def bonus_payable(total, balance): if balance < total // 2:return balancereturn total // 2 return min(balance, total // 2)different structure, same behavior —the check above is still green

The loop on the left and its traces on the right. The check is written first — it's red, because the code doesn't exist yet. Minimal code turns it green. Then the code is cleaned up: fewer lines, the same check, still green — and that is the proof that the behavior didn't drift. Then the loop starts over for the next behavior, and the net of checks grows to cover whatever gets cleaned up later.

The idea: process and engineering are separate axes

It's easy to confuse XP with Scrum, because both belong to Agile. But they're about different things and combine well.

Scrum and Kanban manage the flow of tasks. They say how to split up the work, how to prioritize it, how to keep the team in sync. They don't dictate how your code is structured. You can run the board perfectly and still have code that can't be changed without risk.

XP looks inside the code. Its central hypothesis: the cost of change doesn't have to grow over time. In the classic model, the later you make a change, the more expensive it is — because the code is tangled, there are no tests, and no one remembers how it works anymore. XP argues that with the right practices the cost-of-change curve stays flat, and then frequent small releases become not a risk but the norm.

From this comes a simple rule: if something is worth doing, do it constantly and take it to the extreme. Testing is worthwhile — so we write tests for everything, always. Integration is worthwhile — so we integrate several times a day rather than once a sprint. Hence the word "extreme."

Practices: how XP makes changes cheap

XP isn't a single idea but a bundle of practices that reinforce each other. None of them works alone as well as all of them together.

Test-Driven Development (TDD). The test is written before the code. First — a small test that describes the expected behavior and currently fails. Then — the minimal code to make the test pass. Then — cleanup. The cycle is called "red — green — refactor." The point isn't only coverage: a test written first forces you to think through the interface before the implementation and leaves behind a net of checks that catches breakage on every change.

Here's that same loop on one rule — "bonuses cover no more than half of the order." The three checks are written first and never change after that; only the calculation plugged into them changes:

live example

def run(rule):
    cases = [((1000, 800), 500), ((1000, 300), 300), ((0, 300), 0)]
    for (total, balance), expected in cases:
        got = rule(total, balance)
        if got != expected:
            return f"red: order {total}, balance {balance} — expected {expected}, got {got}"
    return f"green: {len(cases)} of {len(cases)}"

print(run(lambda total, balance: balance))
print(run(lambda total, balance: balance if balance < total // 2 else total // 2))
print(run(lambda total, balance: min(balance, total // 2)))
Run

Running examples is part of paid access. There the same code runs inside the article: editor, run and check next to the paragraph. Free week →

The first line of output is red: there's no half-of-the-order calculation yet, so the whole balance is spent. The second is the minimal code; the third is the same calculation after cleanup — the same logic in a single min, same output. That's the whole point of tests first: they don't just catch the mistake, they give you permission to touch code that already works.

Pair programming. Two people work on one task: one writes the code, the other thinks a step ahead — about edge cases, names, design. The roles switch. It's continuous review in real time: mistakes are caught at the moment of writing, not a day later in a pull request. Plus, knowledge about the code isn't locked inside one head.

Continuous Integration (CI). Everyone merges their changes into the shared branch often — several times a day, rather than piling them up for weeks. On every merge the project is built automatically and the tests are run. Small frequent merges produce almost no conflicts; rare large ones produce painful ones.

Refactoring. Improving the structure of the code without changing its behavior. Rename, split a long method, remove duplication. In XP this isn't a separate "cleanup phase once a quarter" but constant hygiene: you see something get tangled, you clean it up right away. It's the tests that make refactoring safe: if the code is green after a rearrangement, the behavior hasn't changed.

Collective code ownership. Any team member has the right to edit any part of the code. There's no "this is Pete's module, only Pete touches it." That way the points where everything stalls because one person is missing disappear, and anyone can make the improvement they spotted right where they spotted it.

Simple design and YAGNI. The "You Aren't Gonna Need It" principle — don't build an abstraction for a hypothetical future requirement. Do the simplest solution that works now and is covered by tests. When the requirement actually arrives — refactoring and tests let you safely extend the design. "Flexibility just in case," baked in ahead of time, more often becomes a burden than a help.

Frequent small releases. Ship in small portions and often. A small release is easier to test, easier to roll back, and gives faster feedback from real users. A large, rare release accumulates risk and postpones the moment you learn that something went wrong.

Feedback at every level

If you look at XP's practices together, a common motif emerges: shorten the time between "did something" and "found out what it led to." The shorter the feedback loop, the cheaper the mistake — it's caught while it's still fresh and small.

Feedback loopWhat it givesSpeed
Test (TDD)broke behavior — found out immediatelyseconds
Pairbad name or edge case — noticed while writingminutes
CIconflict or a red build — found out on mergeminutes
Small releasewrong behavior for the user — seen quicklyhours–days
Sprint demo (Scrum)building the wrong featureweeks

Each level catches its own class of problems at its own timescale. A test won't notice that you're building the wrong feature — the demo will. The demo won't notice a typo in a condition — the test will catch it. XP tries to have a fast check at every scale, rather than one slow one at the very end.

What caught on everywhere, and what less so

XP took shape on a Chrysler project in 1996, and Kent Beck's book "Extreme Programming Explained" came out in 1999 — and back then it sounded radical. Since then the industry has "digested" its practices unevenly: some became the de facto standard, some are seen less often.

Firmly part of everyday practice:

  • TDD — at least in the form of a strong automated-testing culture; writing code without tests is considered bad form on most teams today.
  • Continuous Integration — this is the baseline today: a CI pipeline that builds the project and runs the tests on every commit is almost everywhere. Out of it grew the CI/CD practices of frequent automatic delivery.
  • Refactoring — has become an ordinary part of daily work, supported by tools in any IDE.
  • Simple design and YAGNI — entered the common vocabulary as a sensible principle against over-engineering.

Applied less often and selectively:

  • Full-day pair programming — not everyone practices it. It's expensive in time and tiring, so it's more often used pointwise: for hard tasks, bringing new people into a project, or working through a tangled section. Asynchronous reviews in pull requests provide a partial substitute.
  • Full collective ownership — in large organizations this is softened: there are often "owners" of subsystems responsible for architectural decisions, while small edits are allowed to everyone.

Even a team that doesn't call itself an "XP team" almost certainly lives on its practices: TDD, CI, refactoring, and simple design have become the common backdrop of engineering culture — and it's precisely these that make the frequent releases Agile promises actually safe.

In short

  • XP answers not the question "how to organize the work" (that's Scrum and Kanban) but the question "how to write code so that frequent changes are cheap and safe."
  • The central idea — the cost of change doesn't have to grow over time; with the right practices the curve stays flat.
  • Key practices: TDD (test before code), pair programming, continuous integration, refactoring, collective ownership, simple design (YAGNI), frequent small releases.
  • The practices reinforce each other: tests make refactoring safe, CI catches conflicts early, the pair gives review in real time.
  • The common principle — short feedback loops: a test reacts in seconds, the pair and CI in minutes, a release in hours, a demo in weeks.
  • TDD, CI, refactoring, and YAGNI are the de facto standard; full-day pair programming and full collective ownership are applied less often — pointwise or in a softened form.
  • The testing pyramid — how to structure automated tests so that TDD gives fast feedback.
  • CI/CD pipeline principles — what continuous integration grew into: automatic build, tests, and delivery on every commit.
  • Clean Code — the principles that refactoring and simple design rest on.
  • Scrum — the process methodology XP combines well with: different axes of the same task.