Extreme Programming

Extreme Programming Overview

  • Influential agile method developed in the late 1990s that introduces a range of agile dev techniques.

  • Some XP practices are in common use today.

  • "Extreme" approach to iterative development:

    • New versions may be built several times per day.

    • Increments delivered to customers every two weeks.

    • All tests are run for every build; the build is accepted only if tests succeed.

XP Release Cycle

  • Steps in Release Cycle:

    • Select user stories for this release.

    • Break down stories into tasks.

    • Plan release.

    • Develop, integrate, and test software.

    • Release software.

    • Evaluate system.

XP

  • Set of software engineering practices that produce high-quality software with limited effort.

  • Lightweight software development process

    • Replaces documentation with communication.

    • Focuses on source code and testing.

    • Strong productivity improvements.

  • Developed by industry practitioners.

XP Fundamentals

  • Distinguish between decision made by business stakeholders and developers.

  • Simplistic design: "Design for today, not for tomorrow".

  • Write automated test code before writing production code and keep all tests running.

  • Pair programming.

  • Very short iterations with fast delivery.

Controversies Surrounding XP

  • No specialists: every programmer participates in architecture, design, test, integration.

  • No up-front detailed analysis and design.

  • No up-front development of infrastructure.

  • Not much writing of design and implementation documentation beside tests and code.

When can XP be used?

  • Small projects: 5-10 developers, up to 20.

  • Developer and customer rep are co-located.

Problems with XP

  • Point and go culture

  • Testing takes hours to execute

Cost of Change in XP

  • XP reduces costs associated with change over time.

The Four XP Values

  1. Simplicity: "The simplest thing that could possibly work" (YAGNI: You Aren't Gonna Need It).

  2. Communication: Essential among developers, users, customers, testers, code.

  3. Feedback: Via testing, experimenting, delivering.

  4. Courage: Trust in practices and processes, history.

XP Practices

  1. Planning Game

  2. Short Releases

  3. Simple Design

  4. Testing

  5. Refactoring

  6. Pair Programming

  7. Collective Ownership

  8. Continuous Integration

  9. On-site Customer

  10. Sustainable Pace

  11. Metaphor

  12. Coding Standards

Influential Principles of XP

  • XP emphasizes technical focus and is not easy to integrate with management practices.

  • Key themes: user stories for specifications, refactoring, test-first development, pair programming, and continuous integration.

Planning Game

  • Recognition: You can’t know everything when you start. Customers will learn about what they want by looking at what you’ve done so far. Developers will learn about the domain and tech as the project progresses and what questions to ask.

  • Release Planning: Define and estimate higher-level features down to 5-10 days effort each. Customer lays features in fixed-length iteration schedule.

  • Iteration Planning: Define and estimate higher-level features down to 3 or less days effort each and detailed story cards within next iteration. Customer lays features in fixed-length iteration schedule.

  • User Stories: Written on a card. Chunk of functionality that is coherent to customers. Given priority/ value by the customer based on business value. Given estimate and risk by developers.

Testing

  • Unit Tests: Code it first in small increments. When releasing new code run all the unit tests on the integration machine. Must run at 100% before checking in feature. If any test fails, figure out why and the fix. The problem has to be in something they did as the tests ran at 100% at the last release.

  • Acceptance Tests: Test cases extracted from customer. Test system end to end. Tells the customer and the developers if the system has the features its supposed to. Don’t have to run at 100%. Progress used t o measure Project Velocity.

  • Junit Testing: A small testing framework written in Java. Series of extensible classes that do much of the testing grunt work. Handy for XP.

Test Automation

  • Tests are written as executable components before the task is implemented.

  • Components should be stand along, stimulate the submission of input to be tested and check that the result meets the output spec.

  • Automated test framework is a system that makes it easy to write executable tests and submit a set of tests for execution.

Problems with Test First Development

  • Programmers prefer programming to testing and can take shortcuts.

  • Tests can be difficult to write incrementally.

  • Difficult to judge the completeness of a set of tests.

Refactoring

  • Changing internal structure without changing external behaviour.

  • Changing the code without changing its functionality.

Why Refactor

  • Improve design of software.

  • Make code easier to understand.

  • Make code easier to maintain.

  • Find bugs.

When to Refactor

  • Repeating code.

  • Code difficult to understand.

  • Long methods/ functions.

Metaphor

  • Use a system of names.

  • Use a common system description.

  • Helps communicate with customers, users. stakeholders and programmers.

Advantages of XP

  • Promotes team cooperation and support.

  • Strong support for changing/emerging reqs.

  • Can improve quality.

  • Recognises that reqs cannot be fully captured at the beginning.

  • Continual training and knowledge transfer.

  • Test first is cost effective.

  • Avoids over specialisation.

Limitations of XP

  • Customers on site continuously.

  • Co-location of team required.

  • Questions on the scalability of the process.

  • Considered harmful for reliable software dev.

  • Can productivity benefits be transferred to a distributed environment?