Skip to content

Chapter 3: Agile Software Development

Executive Summary

In the 1980s and 1990s, software engineering was dominated by "plan-driven" approaches characterized by rigorous planning, extensive documentation, and strict sequential phases. While effective for massive, decade-long aerospace or government projects, these heavyweight methods proved too rigid for the fast-paced, rapidly changing landscape of modern business. This chapter explores Agile Software Development, a paradigm shift designed to drastically reduce process overhead, embrace changing requirements, and deliver business value through rapid, iterative increments. We will dissect the core agile techniques (such as Extreme Programming), explore agile project management (Scrum), and analyze the challenges of scaling agile for large enterprise systems.


3.1 The Shift: Plan-Driven vs. Agile Methods

To understand why agile exists, we must first understand what it replaced.

The Plan-Driven (Traditional) Approach

  • The Core Assumption: All system requirements can be known, specified, and documented before any design or coding begins.
  • The Process: A linear progression (e.g., Waterfall). You finish Requirements completely, hand off a massive document to Designers, who hand off schematics to Programmers, who hand off code to Testers.
  • The Problem: In reality, requirements always change. Business needs evolve, competitors release new products, and customers rarely know exactly what they want until they see a working prototype. When changes occur in a plan-driven model, you must go back and update hundreds of pages of documentation, causing severe delays.

The Agile Paradigm

Agile methods reject the idea of complete upfront planning. Instead, they propose a highly adaptive, iterative lifecycle. The core philosophy is captured in the Agile Manifesto, which values:

  1. Individuals and interactions over processes and tools.
  2. Working software over comprehensive documentation.
  3. Customer collaboration over contract negotiation.
  4. Responding to change over following a plan.

Five Key Agile Principles

  1. Customer Involvement: The customer is a continuous, active member of the development team, prioritizing features and evaluating increments.
  2. Embrace Change: The architecture and process are specifically designed to easily accommodate new requirements at any stage.
  3. Incremental Delivery: Software is built and released in small, frequent chunks (e.g., every 2–3 weeks).
  4. Maintain Simplicity: Do enough design for the current requirements and absolutely no more.
  5. People, Not Process: Exploit the skills of the development team through practices like pair programming, avoiding rigid administrative workflows.

3.2 Agile Development Techniques (Extreme Programming)

While "Agile" is the philosophy, Extreme Programming (XP) provided the first widely adopted set of concrete technical practices. XP takes recognized good software engineering practices and turns the dial up to "extreme".

1. User Stories (Replacing Requirements Documents)

Instead of formal "The system shall..." statements, XP uses User Stories: brief, plain-language scenarios written on physical or digital cards.

  • The "How": They act as a placeholder for a conversation. During an iteration planning meeting, developers discuss the story with the customer, break it down into technical tasks, and estimate the effort.
  • Mastery Application:
    • Story: "As a doctor prescribing medication, I want the system to warn me if a prescribed dose is outside safe limits."
    • Tasks derived: (1) Build UI alert box. (2) Write SQL query to fetch max/min dosage limits from the formulary database. (3) Write validation logic to compare input against limits.

2. Refactoring (Continuous Code Improvement)

Traditional engineering says "design for change"—anticipate future needs and build generic frameworks. XP says this is wasted effort because anticipated changes rarely happen. Instead, build the simplest thing today, but Refactor constantly.

  • The "Why": As software is incrementally patched, its structure naturally degrades (this is called "technical debt"). Refactoring is the process of cleaning up the code (removing duplicates, renaming variables, simplifying loops) without changing its external behavior.
  • The "How": If a developer spots clunky code, they fix it immediately, regardless of who originally wrote it (a principle called Collective Ownership).

3. Test-First Development (TDD)

Perhaps the most crucial technical legacy of XP. You do not write code and then test it. You write the test before the code exists.

  • The Process: 1. Write a test for a tiny piece of functionality. 2. Run it (it fails, because the feature isn't built yet). 3. Write the exact amount of code needed to make the test pass. 4. Refactor the code to clean it up.
  • The "Why": It forces the developer to explicitly define the interface and behavior before getting lost in implementation logic. Furthermore, it results in a comprehensive suite of automated tests. If a developer accidentally breaks existing logic while adding a new feature, the automated test instantly fails, catching the bug before deployment.
  • Mastery Application (Python TDD Example):
    python
    # 1. The Test (Written First)
    def test_dose_checking():
        assert is_dose_safe(drug="Aspirin", amount=500) == True
        assert is_dose_safe(drug="Aspirin", amount=5000) == False # Overdose
    
    # 2. The Implementation (Written Second)
    def is_dose_safe(drug, amount):
        max_limits = {"Aspirin": 1000, "Ibuprofen": 800}
        if amount > max_limits.get(drug, 0):
            return False
        return True

4. Pair Programming

Developers work in pairs at a single computer.

  • The "Why": It provides real-time, continuous code review. While one developer types (focusing on syntax), the other navigates (focusing on overall strategic logic and spotting typos). It also ensures that at least two people thoroughly understand every piece of the codebase, eliminating "islands of expertise."

3.3 Agile Project Management (Scrum)

While XP focuses on technical execution, Scrum provides an overarching management framework. Traditional project managers need visibility (schedules, budgets), but agile teams need autonomy. Scrum bridges this gap.

Core Scrum Terminology & Roles

  • Product Owner: Represents the business and customers. They own the "Product Backlog" and dictate what gets built based on business value.
  • ScrumMaster: Replaces the traditional "Project Manager." They do not command the team; they act as a facilitator and shield the team from external distractions.
  • Development Team: A self-organizing group of max 7-9 people. They alone decide how to build the software.

The Scrum Process (Sequential Execution)

  1. Product Backlog: A master list of all desired features (user stories), prioritized by the Product Owner.
  2. Sprint Planning: The team decides how much work they can commit to pulling from the top of the Product Backlog into the upcoming "Sprint".
  3. The Sprint: A fixed time-box (e.g., 2–4 weeks) where the team executes the work to create a potentially shippable increment. Crucial Rule: No outside changes can be added to a Sprint once it begins.
  4. Daily Scrum (Stand-up): A 15-minute daily meeting where members quickly state: What they did yesterday, what they will do today, and any blockers in their way.
  5. Sprint Review & Retrospective: The team demonstrates the working software to stakeholders and then reflects internally on how to improve their processes for the next Sprint.
  • Mastery Application (Velocity): How does a Scrum team know what they can achieve in a Sprint? They track Velocity—a measure of how many "story points" they historically complete per iteration. If their average velocity is 40 points, they only pull 40 points worth of work into the next Sprint.

3.4 Scaling Agile Methods

Agile was designed for small, co-located teams (e.g., 8 people in one room). However, modern enterprises build "Systems of Systems" requiring hundreds of developers. Scaling agile is a massive industry challenge.

The Challenges of Scale

  • System Size & Architecture: You cannot simply "emerge" an architecture for a massive system; some upfront architectural design is mandatory before coding begins.
  • Geographic Distribution: Global teams cannot easily rely on informal, face-to-face communication.
  • Regulatory Compliance: Aviation, medical, and financial systems legally require extensive documentation and safety cases, contradicting the "working software over documentation" manifesto principle.

Solutions (e.g., IBM's Agility at Scale Model)

To scale, organizations must adopt a hybrid approach, blending agile execution with plan-driven governance:

  1. Upfront Requirements: A complete, detailed requirements document isn't needed, but a high-level system outline is mandatory to define contracts and separate subsystems.
  2. Multiple Product Owners: A single customer cannot understand a massive enterprise system. A hierarchy of Product Owners is required.
  3. Cross-Team Synchronization: Using frameworks like "Scrum of Scrums" (where representatives from multiple individual Scrum teams meet to coordinate) and aligning release schedules across all teams.
書體

本站所載,間有由 AI 所生成者。其辭義真偽,請君自審之。