Extreme Programming

Extreme Programming

In extreme programming, requirements are expressed as scenarios. Call stories which are implemented directly as a series of tasks Programmers work In-plane and develop the test for each task before writing code.

Extreme programming is an object-oriented development approach and provides four framework activities: planning, design, coding and testing.

Extreme Programming (XP) Framework Activities:

  1. Planning:

    • XP is an object-oriented development approach comprising four key activities: planning, design, coding, and testing.

    • Planning initiates with the creation of user stories, similar to use cases, outlining how the software will be used and the desired functionality.

    • User stories are prioritized by the customer, and the development team estimates the required development time for each story.

    • Stories are grouped into deliverables, and each deliverable is assigned a delivery date.

    • Project velocity, determined after the first increment, aids in estimating delivery times for subsequent increments.

    • New stories can be added anytime, prioritized, and incorporated into the appropriate deliverable.

  2. Design:

    • The design activity centers around Class-Responsibility-Collaborator (CRC) cards for organizing classes to be implemented.

    • CRC cards serve as the primary design documentation in this process model.

    • Prototyping, specifically a spike-solution, is employed when design decisions are challenging, helping evaluate risks and estimate implementation time.

    • Refactoring is encouraged to reorganize the internal code structure without changing behavior, keeping the software development process flexible.

  3. Coding:

    • Unit test cases are developed before coding, ensuring comprehensive testing of each story in the release.

    • Developers code to satisfy unit tests, enhancing understanding of code usage and implementation.

    • Pair programming is a distinctive feature, where two programmers work together, with one coding and the other ensuring adherence to coding standards.

  4. Testing:

    • Unit tests, created before coding, are recommended to be part of a framework for easy and repeated execution.

    • Daily software testing is facilitated by running unit tests regularly.

    • Acceptance tests, defined by the customer, focus on visible functionality and derive from stories used in software development.

Extreme programming principle:-

  1. Incremental planning:

    Requirements are recorded on Story Cards, and the stories to be included in a release are determined by the available time and their relative priority. The developers break these stories into development tasks.

  2. Small releases:

    The minimal useful set of functionality that provides business value is developed first. Releases of the system are frequent and incrementally add functionality to the initial release.

  3. Simple design:

    Enough design is carried out to meet the current requirements and no more.

  4. Test-first development:

    An automated unit test framework is used to write tests for a new piece of functionality before implementing that functionality itself.

  5. Refactoring:

    All developers are expected to continuously refactor the code as soon as possible when code improvements are found. This practice keeps the code simple and maintainable.

  6. Pair programming:

    Developers work in pairs, checking each other’s work and providing support to ensure a high-quality outcome.

  7. Collective ownership:

    Pairs of developers work on all areas of the system, preventing islands of expertise from developing, and ensuring that all developers take responsibility for all of the code. Anyone can change anything.

  8. Continuous integration:

    As soon as the work on a task is complete, it is integrated into the whole system. After any such integration, all unit tests in the system must pass.

  9. Sustainable pace:

    Large amounts of overtime are not considered acceptable, as the net effect is often to reduce code quality and medium-term productivity.

  10. On-site customer:

    A representative of the end-user of the system (the customer) should be available full-time for the use of the XP team. In an extreme programming process, the customer is a member of the development team and is responsible for bringing system requirements to the team for implementation.

Advantages of Extreme Programming (XP):

  1. Incremental Development:

    XP is an incremental process model, ensuring that the customer gets working software at an early stage of development.

  2. Customer Collaboration:

    Close collaboration between the customer and developers provides a better understanding of software requirements. This active involvement helps in aligning the software with the customer's needs.

  3. Pair Programming:

    Pair programming facilitates quality checks during code development. Two developers working together ensure that the code adheres to standards and is of high quality.

  4. Flexibility to Changing Requirements:

    XP has a robust focus on accommodating changing project requirements. The methodology is designed to adapt and respond to evolving customer needs and business priorities.

Testing in Extreme Programming (XP):

XP emphasizes a unique approach to testing compared to plan-driven development and incremental development. Incremental development lacks a system specification for external testing, leading to informal testing processes.

Key Features of Testing in XP:

  1. Test-first development:

    • Code is written after tests, allowing for immediate problem discovery during development.

    • Writing tests define both an interface and behaviour specification, reducing requirement and interface misunderstandings.

    • Test-first development is fundamental to XP and has influenced broader test-driven approaches.

  2. Incremental test development from scenarios:

    • User requirements in XP are expressed as scenarios or stories, prioritized by the user.

    • Scenarios are broken down into tasks, each generating unit tests for the described implementation.

  3. User involvement in test development and validation:

    • Customers play a crucial role in developing acceptance tests for stories in the next system release.

    • Acceptance testing is incremental, ensuring all new code aligns with customer needs.

  4. Use of automated testing frameworks:

    • Test automation is vital for test-first development.

    • Tests are written as executable components before implementation, ensuring quick detection of new code issues.

    • Automated test frameworks, like Junit, facilitate easy writing and execution of tests.

Challenges in XP Testing:

  1. Limited customer involvement:

    Customer involvement in acceptance test development can be challenging due to time constraints.

  2. Thorough program testing challenges:

    Test automation, while beneficial, may not guarantee thorough program testing.

    Programmers may prefer coding to testing, leading to shortcuts.

    Difficulty in incrementally writing tests for complex user interfaces.

    Challenges in judging the completeness of a test set, potentially leaving crucial parts untested.