---
id: wiki-2026-0508-extreme-programming-xp
title: Extreme Programming (XP)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [XP, Beck XP, pair programming, TDD, continuous integration, refactoring]
duplicate_of: none
source_trust_level: A
confidence_score: 0.96
verification_status: applied
tags: [agile, xp, tdd, pair-programming, ci, software-engineering, beck]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: Universal
  applicable_to: [Agile, Software Process]
---

# Extreme Programming (XP)

## 매 한 줄
> **"매 best practice 의 의 의 의 extreme 의 turn"**. Kent Beck 1999. 매 TDD, 매 pair, 매 CI, 매 refactoring, 매 simple design. 매 modern: 매 XP 의 practices 의 mainstream — 매 XP 의 brand 의 fade, 매 spirit 의 retain (DevOps, trunk-based, AI-paired).

## 매 핵심

### 매 12 practices
1. **Planning game** (story points).
2. **Small releases**.
3. **Metaphor**.
4. **Simple design** (YAGNI).
5. **Testing** (TDD).
6. **Refactoring**.
7. **Pair programming**.
8. **Collective ownership**.
9. **Continuous integration**.
10. **40-hour week**.
11. **On-site customer**.
12. **Coding standards**.

### 매 5 values
- Communication, Simplicity, Feedback, Courage, Respect.

### 매 modern legacy
- **Trunk-based development**.
- **CI/CD**.
- **TDD** (still controversial).
- **AI-paired** (Copilot, Cursor) = modern pair.
- **Mob programming**.

## 💻 패턴

### TDD cycle (Red-Green-Refactor)
```python
# 매 1. Red — failing test
def test_email_validate():
    assert validate_email('a@b.com') is True
    assert validate_email('invalid') is False

# 매 2. Green — minimum
def validate_email(email):
    return '@' in email

# 매 3. Refactor — pattern
import re
def validate_email(email):
    return bool(re.match(r'^[^\s@]+@[^\s@]+\.[^\s@]+$', email))
```

### Pair programming roles
```yaml
driver:
  - types code
  - tactical focus
  - explains as goes
navigator:
  - reviews + thinks ahead
  - strategic
  - catches bugs / typos
rotation: every 25 minutes
```

### Mob programming
```yaml
mob:
  size: 3-5 people
  driver_rotation: 5-10 min
  laptop: single
  goal: continuous learning + team alignment
```

### CI pipeline
```yaml
on: { push: { branches: [main] } }
jobs:
  test:
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm test
      - run: npm run lint
```

### Story (planning game)
```markdown
## Story: User can reset password

### As a user
I want to reset my password
So that I can regain access

### Acceptance criteria
- [ ] Email field validates format
- [ ] Confirmation email sent
- [ ] Token expires after 1 hour
- [ ] Old password invalidated

### Estimate: 3 points
```

### Refactor — Extract Method
```typescript
// 매 before
function processOrder(order) {
  // 매 20 lines mixing validation + calculation + persist
}

// 매 after
function processOrder(order) {
  validate(order);
  const total = calculateTotal(order);
  persist({ ...order, total });
}
```

### Simple design (YAGNI)
```typescript
// 매 ❌ premature abstraction
class GenericRepository<T, K, ...> { ... }

// 매 ✅ simple
class UserRepository {
  async find(id: string): Promise<User | null> { ... }
  async save(u: User): Promise<void> { ... }
}
// 매 abstract 매 매 3rd similar repo
```

### Continuous integration (trunk-based)
```bash
# 매 short-lived branch (< 1 day)
git checkout -b feat/quick-fix
# 매 work
npm test
git add -p; git commit
git push
# 매 PR → review → merge → CI deploy
```

### TDD with AI pair
```python
# 매 modern XP: AI as pair
# 매 driver: human writes test
def test_calculate_discount():
    assert discount(100, 'STUDENT') == 10
    assert discount(100, 'NONE') == 0

# 매 navigator (AI): suggests implementation
def discount(amount, code):
    rules = {'STUDENT': 0.1, 'SENIOR': 0.15}
    return amount * rules.get(code, 0)
```

### On-site customer (modern proxy)
```yaml
modern_equivalent:
  - product_owner: dedicated PM
  - user_research_loop: weekly
  - support_rotation: engineers in support 1d/sprint
  - real_user_feedback: in-app survey + hotjar
```

### Test coverage gate
```yaml
# 매 fail PR if coverage drops
- run: npm run coverage
- run: |
    pct=$(jq '.total.lines.pct' coverage/coverage-summary.json)
    if (( $(echo "$pct < 80" | bc -l) )); then exit 1; fi
```

### Refactoring catalog (Fowler)
```typescript
// 매 Inline Variable
// before
const result = calculate(); return result;
// after
return calculate();

// 매 Replace Magic Number
const TAX_RATE = 0.08;
return total * (1 + TAX_RATE);
```

## 매 결정 기준
| 상황 | Practice |
|---|---|
| Greenfield | All-in XP |
| Legacy + tests | TDD selectively |
| Solo dev | TDD + CI |
| Distributed team | CI + async pair |
| Scale-up | Trunk + feature flags |
| AI-augmented | Copilot + TDD |

**기본값**: 매 modern XP = TDD + CI/CD + trunk-based + pair (or AI-pair) + simple design + small release.

## 🔗 Graph
- 부모: [[Agile]]
- 변형: [[Scrum]] · [[Kanban]] · [[Mob-Programming]]
- 응용: [[TDD]] · [[CI-CD]] · [[Pair-Programming]] · [[Refactoring_Best_Practices|Refactoring]]
- Adjacent: [[Trunk-Based-Development]] · [[Development Communication Standards]] · [[Enterprise-Software-Engineering]]

## 🤖 LLM 활용
**언제**: 매 small team. 매 high-quality requirement. 매 evolving requirement.
**언제 X**: 매 strict regulatory waterfall.

## ❌ 안티패턴
- **Cherry-pick practices**: 매 synergy lose.
- **TDD without refactor**: 매 cruft.
- **Pair as overhead**: 매 communication 의 ignore.
- **No on-site customer**: 매 wrong product.
- **CI without tests**: 매 false safety.

## 🧪 검증 / 중복
- Verified (Beck XP Explained 1999/2004).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-04-26 | XP auto |
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 12 practices + 매 TDD / pair / mob / CI / refactor code |
