Module 3 XP
Module 3 XP
CDV2001
Module 3
• Extreme Programming (XP) is one of the earliest and most influential Agile methodologies, focusing primarily on engineering
excellence and code quality.
• While Scrum emphasizes process and collaboration, XP emphasizes technical practices and clean, maintainable code — a core belief
shared by Uncle Bob.
• XP provides developers with concrete practices to manage changing requirements effectively through frequent delivery,
communication, simplicity, and feedback.
1. Introduction to XP: Core Idea
XP aims to make software development flexible and responsive to change by promoting technical discipline, collaboration, and
simplicity.
XP helps teams:
Respond quickly to changing requirements.
Deliver high-quality software frequently.
Reduce technical debt through continuous improvement.
Mike Cohn describes XP as complementing Scrum — Scrum manages workflow and delivery, while XP strengthens engineering and
development practices.
XP is built on five fundamental values that guide team behavior and decision-making:
Encourages open and continuous dialogue between Daily stand-ups and pair programming
Communication
developers, testers, and customers. foster shared understanding.
Focus on solving today’s problem only — avoid over- Design only what’s needed for the current
Simplicity
engineering. sprint.
Regular feedback from tests, code reviews, and Continuous integration detects defects
Feedback
customers improves quality. immediately.
Courage to refactor code, accept criticism, or change Deleting poor code and redesigning to
Courage
course when needed. improve quality.
Team members trust and value each other’s Developers and customers collaborate
Respect
contributions. equally on decisions.
1. Rapid feedback: Testing and customer validation after every small change.
2. Assume simplicity: Start simple and evolve designs as needed.
3. Incremental change: Continuous small improvements instead of big redesigns.
4. Embrace change: Change is expected and welcomed, not feared.
5. Quality work: Technical excellence leads to sustainable productivity.
Mike Cohn reinforces that XP’s incremental feedback and adaptability are key drivers of Agile success — ensuring business and technical
alignment throughout.
XP defines 12 key practices to implement its philosophy effectively. These practices are often called “Extreme” because they take good
development practices to their limit.
Category XP Practice Explanation
Design & Coding Simple Design Design only for current needs; evolve later.
Pair Programming Two developers work together — one writes, the other reviews.
Testing & Feedback Test-Driven Development (TDD) Write tests before writing the code.
Continuous Integration Integrate and test code frequently to detect defects early.
Team Practices Collective Code Ownership Any developer can improve any part of the code.
XP is ideal when:
• Requirements change frequently.
• Teams need to deliver high-quality software fast.
• Developers are co-located and communicate frequently.
• Technical excellence and maintainability are critical.
Example:
A fintech startup building an online payment platform adopts XP to deliver updates every week. Using TDD and continuous integration,
they ensure secure and bug-free code while quickly adapting to new banking regulations.
Mike Cohn’s insight: XP fits best for teams that already follow Scrum but need to improve how they build software — XP strengthens
Scrum’s “how” to complement its “what.”
Aspect XP Scrum
Technical excellence and Process management and team
Focus
engineering discipline collaboration
Short cycles (1–2 weeks) with
Iteration Fixed-length sprints (2–4 weeks)
continuous feedback
TDD, pair programming, Sprint planning, review,
Practices
refactoring, CI retrospective
Customer is part of the team (on- Customer represented by Product
Customer Involvement
site customer) Owner
Maintain code quality and Deliver business value through
Goal
adaptability collaboration
Uncle Bob: XP ensures developers write clean, maintainable code — the true heart of Agile craftsmanship.
Mike Cohn: XP complements Scrum by providing the technical backbone that makes Agile sustainable.
Extreme Programming (XP) focuses on delivering high-quality software through short iterations, continuous feedback, and embracing
change.
Where Scrum provides a management framework, XP provides technical and planning practices that make agility possible in real
software engineering.
The XP lifecycle revolves around planning, developing, integrating, and releasing software in frequent, customer-validated cycles.
1. XP Lifecycle Overview
XP follows a cyclic, iterative, and evolutionary process, where the software grows through frequent iterations and releases.
The lifecycle consists of three main stages:
Key principles:
• Deliver working software early and often.
• Incorporate feedback into the next iteration.
• Maintain continuous integration and refactoring to ensure code quality.
Example:
An online shopping team releases new features every two weeks — like “Add to Cart,” “Wishlist,” and “Order Tracking.” Each release
builds upon earlier iterations, guided by customer feedback.
Role Responsibility
Customer (Business) Defines what to build by writing and prioritizing user stories.
Developers Estimate how much effort is required to implement each story.
1. Release Planning
• Determines which features (user stories) will go into the upcoming release.
• Customers select features based on business value; developers commit based on velocity (past performance).
• The goal is to balance value, risk, and effort.
2. Iteration Planning
• At the start of each iteration, developers choose a subset of user stories from the release plan.
• Tasks are defined, estimated, and assigned.
• Developers self-organize to deliver working software by the end of the iteration.
Uncle Bob: “The Planning Game reflects respect between business and developers — each side contributes its expertise to a shared
plan.”
Mike Cohn: “This collaborative planning embodies the Agile principle of customer collaboration over contract negotiation.”
User Stories
•User stories are short, simple descriptions of desired functionality.
•Format:
•“As a [user role], I want [goal] so that [benefit].”
Example:
“As a shopper, I want to receive SMS order confirmations so that I can track my delivery.”
Stories are prioritized by business value and sized by effort.
Estimation
• Estimation in XP uses relative effort, often measured in Story Points or Ideal Days.
• Developers provide estimates collaboratively using the Planning Game.
• Business uses these estimates and past velocity to predict future delivery.
Uncle Bob: “Change is not a failure of planning; it’s a natural part of software evolution.”
Mike Cohn: “XP’s adaptability ensures business priorities are always reflected in what’s delivered.”
Key Takeaways
•XP’s lifecycle is iterative and evolutionary, focused on continuous value delivery.
•The Planning Game ensures collaboration between business and developers.
•User stories and short iterations make it easy to adapt to change.
•Uncle Bob emphasizes clean, simple, maintainable code as the foundation for agility.
•Mike Cohn emphasizes transparency, customer involvement, and learning through feedback.
The “Whole Team” concept is central to XP. It means that everyone necessary to deliver a successful software product works together
as one unit, usually in a shared physical (or virtual) space.
There is no hierarchy — each role adds unique value but collaborates continuously.
Uncle Bob: XP’s “whole team” embodies professionalism — every team member owns the code, quality, and process.
Mike Cohn: Strong cross-functional collaboration is a hallmark of successful Agile teams — shared goals lead to shared success.
Write, refactor, and test code using Programmers are craftsmen — they Emphasizes technical excellence and
1. Programmer XP practices like TDD and pair must maintain clean, simple, and shared ownership to maintain
programming. tested code. velocity.
Represents business needs; writes Essential for short feedback loops — Continuous customer involvement
2. Customer (On-Site Customer) and prioritizes user stories; clarifies ensures technical work always aligns ensures that the team builds the
requirements daily. with real user value. right product.
Guides the team in applying XP Helps programmers develop Acts as Scrum Master-like role —
5. Coach practices and Agile principles discipline, maintain clean code, and facilitates continuous improvement
effectively. uphold Agile values. and team cohesion.
1. Programmer Customer
•Constant interaction — customers provide stories, programmers deliver working software for review.
•Daily collaboration ensures feedback and clarification are immediate.
Example: The customer asks for a “refund process”; programmers discuss edge cases directly, ensuring shared understanding.
2. Programmer Tester
•Programmers use Test-Driven Development (TDD) to build unit tests.
•Testers complement this by writing acceptance tests based on user stories.
•Together, they ensure both technical and functional quality.
3. Customer Tester
•Customers define “what success looks like” through acceptance criteria.
•Testers convert those criteria into executable acceptance tests.
•This guarantees that business requirements are met precisely.
5. Coach Team
•Mentors the team in applying XP principles: communication, simplicity, feedback, courage, and respect.
•Encourages pair programming, refactoring, and continuous improvement.
•Acts as the guardian of XP values, similar to the Scrum Master role in Scrum.
Uncle Bob: “The coach does not command; they remind the team of their discipline.”
Mike Cohn: “An Agile coach nurtures self-organization — guiding without authority.”
Uncle Bob: XP’s collaborative model ensures continuous learning; knowledge isn’t trapped with individuals.
Mike Cohn: Collaboration reduces defects and increases team morale, key to long-term success.
Role Contribution
Writes stories like “As a user, I want to see when
Customer
others are typing.”
Implement this with TDD; one writes code, the other
Programmers
reviews (pair programming).
Creates automated acceptance tests to confirm that
Tester
typing status updates correctly.
Notes that team velocity has improved by 10% since
Tracker
automating tests.
Encourages regular retrospectives and maintains
Coach
adherence to XP practices.
Outcome: Continuous feedback and open communication lead to fast, high-quality releases with minimal rework.
Integration Insight:
Mike Cohn often recommends combining Scrum for project management and XP for engineering discipline — the best
of both worlds.
8. Key Takeaways
XP’s whole team approach eliminates hierarchy and promotes shared accountability.
Each role contributes to communication, simplicity, feedback, and respect — XP’s five values.
XP’s roles align closely with Scrum’s, but place more focus on technical rigor and real-time collaboration.
Uncle Bob: XP is the craftsmanship backbone of Agile.
Mike Cohn: XP’s collaborative roles build the culture necessary for sustainable agility.
Two of the most important engineering practices in Extreme Programming (XP) are
[Link] Programming and
[Link]-Driven Development (TDD).
These are the backbone of XP’s technical discipline, ensuring that software is clean, reliable, and adaptable to change.
While Scrum focuses on managing work, XP focuses on how to build quality software effectively.
Both Uncle Bob and Mike Cohn emphasize that without solid engineering foundations, agility cannot be sustained.
1. Pair Programming
Definition
Pair programming is an XP practice where two programmers work together at one workstation.
•One acts as the Driver — writing code.
•The other acts as the Navigator — reviewing each line, thinking ahead, and suggesting improvements.
They frequently switch roles.
Uncle Bob: “Pair programming is not two people doing one person’s job — it’s two brains collaborating on clean, thoughtful code.”
Mike Cohn: “Pair programming improves code quality and team learning, reducing the cost of defects and rework.”
Benefit Description
Improved Quality Continuous review prevents defects early.
Skills spread among team members, reducing Uncle Bob: Pair programming
Knowledge Sharing
dependency on individuals. enforces clean code principles —
Two perspectives lead to simpler, cleaner naming clarity, small functions, and
Better Design Decisions single responsibility.
design.
Promotes communication and shared
Enhanced Team Cohesion Mike Cohn: Pairs produce fewer
ownership of code.
defects, often leading to higher long-
Two minds can identify solutions faster during term velocity despite a slight short-
Faster Problem Solving
complex challenges. term cost.
TDD is a software development practice where tests are written before the code that implements the functionality.
It follows a short, repeatable cycle:
Red → Green → Refactor
Step Description
Write a small failing test for new
Red
functionality.
Write just enough code to make the
Green
test pass.
Clean up the code, ensuring all tests
Refactor
still pass.
Purpose of TDD
TDD in XP Lifecycle
Together, these practices promote continuous feedback, simplicity, and technical excellence — the foundation of Agile
craftsmanship.
5. Summary Table
Extreme Programming (XP) emphasizes technical excellence — the belief that high-quality software design and clean code enable rapid,
flexible change.
Together, they ensure that software remains adaptable, maintainable, and collaboratively developed.
1. Simple Design
Concept
Simple Design means keeping the design of the system as simple as possible, implementing only what is necessary to meet current
requirements — no more, no less.
Rule Explanation
The system must be fully functional and correct — nothing is
1. Runs All Tests
“broken.”
Avoid redundant logic; every piece of knowledge should have
2. No Duplication
one representation.
Code should clearly express intent — understandable by
3. Expressive Code
other developers.
Keep the design as small and focused as possible — no
4. Minimal Classes and Methods
unnecessary abstractions.
Technique Purpose
Extract Method Break large functions into smaller, meaningful units.
Rename Variable/Method Improve clarity and readability.
Simplify Conditionals Replace complex logic with simpler expressions.
Remove Duplication Consolidate repeated code into reusable components.
Replace Magic Numbers Use named constants for clarity.
Example:
Before refactoring:
if (status == 1) sendEmail("Active");
if (status == 2) sendEmail("Inactive");
if (status == 3) sendEmail("Pending");
After refactoring:
sendEmail(getStatusMessage(status));
private String getStatusMessage(int status) {
switch(status) {
case 1: return "Active";
case 2: return "Inactive";
case 3: return "Pending"; The code is now clear, concise, and reusable.
default: return "Unknown";
}}
PRESIDENCY UNIVERISTY, BENGALURU, School of CSE
3. Collective Code Ownership
Concept
In XP, Collective Code Ownership means that any developer can modify any part of the codebase at any time.
There are no “my code” or “your code” zones — the entire team owns the system collectively.
Key Principles
•Everyone can refactor, fix, or improve any part of the code.
•Encourages shared responsibility and team accountability.
•Reduces knowledge silos — no single point of failure.
•Promotes code consistency — everyone follows shared standards.
Benefits
Benefit Description
Everyone understands the full system, reducing
Shared Knowledge
dependencies on individuals.
Improved Code Quality More eyes mean more feedback and fewer defects.
Continuous Improvement Anyone can fix issues as soon as they find them.
Team Collaboration Encourages open communication and mentorship.
Example:
A developer notices a performance issue in another module. Instead of waiting for its “owner,” they fix and commit it — maintaining
high team velocity.
Outcome:
•Minimal technical debt.
•Flexible system ready for new requirements. 7. Key Takeaways
•High morale and shared responsibility. •Simple Design → Solve today’s problem, not tomorrow’s.
•Refactoring → Keep the code clean, flexible, and alive.
•Collective Ownership → The whole team owns quality and design.
6. Summary Table
Aspect Description T1 – Uncle Bob T2 – Mike Cohn
Keep design minimal and Avoid unnecessary
Simple Design Enables adaptability
expressive complexity
Improve internal design Clean code requires constant Sustains agility and reduces
Refactoring
without changing behavior refinement cost of change
Professional responsibility Encourages self-organization
Collective Ownership Team jointly owns all code
shared by all and collaboration
Core Principles of CI
[Link] early and often: Merge changes several times per day.
[Link] builds and tests: Run unit and acceptance tests automatically.
[Link] the build fast and visible: The team should immediately see if something breaks.
[Link] broken builds immediately: A broken build halts progress — repair it before proceeding.
Example
Responsibility Explanation
Define Requirements Writes and prioritizes user stories.
Clarify Details Answers questions instantly to prevent assumptions.
Validate Deliverables Tests completed stories and gives feedback.
Decides which features deliver the most business
Set Priorities
value.
Example
In an insurance project, a claims officer (on-site customer) works daily with developers.
When a new “Claim Approval” feature behaves unexpectedly, she immediately provides the correct rule — saving time
and avoiding rework.
6. Summary Table