XP (not Microsoft) e X treme P rogramming Can KOMAR [email protected].

34
XP (not Microsoft) eXtreme Programming Can KOMAR [email protected]

Transcript of XP (not Microsoft) e X treme P rogramming Can KOMAR [email protected].

XP (not Microsoft)

eXtreme Programming

Can KOMAR

[email protected]

eXtreme Programming 223/11/2005

Contents

Introduction Why XP? Values of XP Overview of XP Practices of XP Discussion

eXtreme Programming 323/11/2005

What is XP?

XP is a specific instantiation of an agile process

XP combines best practices in a different way

XP is a different approach to development XP provides a core process model XP is not intended to be a complete

framework

eXtreme Programming 423/11/2005

Cost

of

Ch

an

ge

Req Analysis Design Code Test O&M

XPView

Cost

of

Ch

an

ge

Req Analysis Design Code Test O&M

TraditionalView

eXtreme Programming 523/11/2005

4 Values of XP

Simplicity KISS Implement the simplest that works

Communication Use all means that enable better communication

Feedback at various levels minutes unit tests, days functional tests, weeks early

production User stories determine the scope

Courage Refactor when needed Throw away code when no longer needed

eXtreme Programming 623/11/2005

Project Overview

http://www.extremeprogramming.org

eXtreme Programming 723/11/2005

Iteration Overview

http://www.extremeprogramming.org

eXtreme Programming 823/11/2005

Development Overview

http://www.extremeprogramming.org

eXtreme Programming 923/11/2005

“Circles of Life”On-site Customer

ReleasePlanning

Small Releases

AcceptanceTests Pair ProgrammingUnit Tests

Refactoring

Simple Design

CodingStandards

CollectiveOwnershipContinuousIntegration

Metaphor

SustainablePace

Customer – Team – Developer Pair – Team – Customer

eXtreme Programming 1023/11/2005

Customer – Team – Developer Pair – Team – Customer

On-site Customer

ReleasePlanning

Small Releases

AcceptanceTests Pair Programming

Unit Tests

Refactoring

Simple Design

CodingStandards

CollectiveOwnership

ContinuousIntegration

Metaphor

SustainablePace

“Circles of Life”

eXtreme Programming 1123/11/2005

On-Site Customer(s)

Empowered to determine requirements, define functionality, set priorities, and answer questions for the programmers

Daily, face-to-face customer interaction should…

reduce the amount of hard-copy documentation

and the high cost associated with its creation and maintenance

eXtreme Programming 1223/11/2005

Release Planning

a.k.a. “Planning Game”

Requires the XP "customer" to define the business value of desired features User Stories

Programmers (not just PM) provide cost estimates for those features

Using this information, customer and developers perform a cost/benefit analysis of each feature enables them to make intelligent decisions about which features to

implement and which to defer

eXtreme Programming 1323/11/2005

User Story #1

A person registers with the agency byproviding personal information,

information,about the kind of person they are seeking, an alias to concealTheir true identity, and confidential

contact details.

Story 1

eXtreme Programming 1423/11/2005

User Story #2

A selection of matching clients isdisplayed, and an email may be

sent to any one of them. A charge willbe made for this service.

Story 2

eXtreme Programming 1523/11/2005

Small Releases

Put a simple system into production quickly, then release new versions on a very short cycle

For example Release might be 2-3 months

Each release might have multiple 2-4 week iterations

Helps establish a “rhythm” Customer and team knows when feedback will occur

Allows the real business value of the product to be evaluated in a real-world environment

eXtreme Programming 1623/11/2005

Test-Driven Development

a.k.a. “Test First”, “Test Infected”

ACCEPTANCE TESTS: Customers are asked to provide acceptance tests in advance of the development of the system. (automated?)

UNIT TESTS: Programmers write tests first based on user stories (requirements) and then create software that fulfills the requirements reflected in the tests.

AUTOMATE, AUTOMATE, AUTOMATE (JUnit, XUnit)

By coding to meet test requirements, we ensure that mandatory features are provided

eXtreme Programming 1723/11/2005

On-site Customer

ReleasePlanning

Small Releases

AcceptanceTests

Pair ProgrammingUnit Tests

Refactoring

Simple Design

CodingStandards

CollectiveOwnership

ContinuousIntegration

Metaphor

SustainablePace

Customer – Team – Developer Pair – Team – Customer

“Circles of Life”

eXtreme Programming 1823/11/2005

Refactoring

Programmers restructure system without changing its behavior to remove duplication, improve communication, simplify, or add flexibility

Small steps

Code, test, refactor, test, code, test, refactor

Beck suggests short cycle (10 minutes)

Typical goal of refactoring is to move toward a design pattern

eXtreme Programming 1923/11/2005

Refactoring

while( no_matches < 20) {

find_another_match();

}

Const int max_matches = 20;

While(no_matches < max_matches) {

eXtreme Programming 2023/11/2005

Pair Programming

All production code written with 2 programmers at 1 machine

One tactical, one strategic

Pairing should be dynamic

Members in pair switch roles every 30-60 minutes

Change pairs each task

Experiments showing effectivenes

eXtreme Programming 2123/11/2005

Pair Programming

What does it buy you? Continuous Code Review Continuous requirements & domain knowledge reinforcement Continuous skills training (Java, Design Patterns, Refactoring, CM

or IDE tools, etc.)

Developers have more trouble with this concept than managers Need to try it a few times to see if it works Takes time to get acclimated More intense development experience

eXtreme Programming 2223/11/2005

Simple Design

Based on philosophy that highest business value is derived from the simplest program that will meet current requirements.

Don’t over-engineer a solution!

While many preach K.I.S.S., this concept is one of the hardest to apply!

2 common philosophies of XP teams:

DTSTTCPW - Do The Simplest Thing That Could Possibly Work

YAGNI - You Aren't Gonna Need It

eXtreme Programming 2323/11/2005

Unit Tests

Test a little, code a little…“Test-first programming”

Tests become the specification Tests give confidence in the system Tests give courage to change the system

eXtreme Programming 2423/11/2005

Unit Tests

eXtreme Programming 2523/11/2005

Customer – Team – Developer Pair – Team – Customer

On-site Customer

ReleasePlanning

Small Releases

AcceptanceTests

Pair Programming

Unit Tests

Refactoring

Simple Design

CodingStandards

CollectiveOwnership

ContinuousIntegration

Metaphor

SustainablePace

“Circles of Life”

eXtreme Programming 2623/11/2005

Coding Standards

Programmers write all code in accordance with rules emphasizing communication throughout the code

Goal: Self-documenting code

Because the “common language” is the code

More than Javadoc; good Javadocs with clear inline comments

eXtreme Programming 2723/11/2005

Metaphor

The XP concept of “architecture”

Guide all development with a single shared story of how the whole system works

Defines a "system of names" and guides the team's development and communication

eXtreme Programming 2823/11/2005

Continuous Integration

Integrate & build the system several times a day

Integrate every time a task is completed

Let’s you know every day the status of the system

eXtreme Programming 2923/11/2005

Collective Ownership

Any programmer can change any code anywhere in the system at any time

This works best if using Coding Standards, Test-Driven Development and Pair Programming (Synergy)

Gives the team more flexibility for vacation, sick leave, turn over

Progress doesn’t stop on a component because one of the team members is not present

eXtreme Programming 3023/11/2005

Sustainable Pace

Tired programmers often write lower-quality code

Minimizing overtime and keeping programmers fresh will produce higher-quality code in less time

Set 40-45 hours as a rule Based on team preference

Corollary: Never work overtime a second week in a row Avoid burnout

eXtreme Programming 3123/11/2005

A Day In XP

eXtreme Programming 3223/11/2005

References

http://www.extremeprogramming.org http://www.xprogramming.com http://www.junit.org http://www.refactoring.com http://www.pairprogramming.com Extreme Programming Explained – Kent Beck Refactoring – Martin Fowler Planning Extreme Programming – Kent Beck et al Extreme Programming Installed – Ron Jeffries et al Extreme Programming Examined – Giancarlo Succi et al Extreme Programming in Practice – Robert C. Martin et al Extreme Programming Explored – William C. Wake Extreme Programming Applied – Ken Auer et al The Costs and Benefits of Pair Programming – Alistair Cockburn et al

eXtreme Programming 3323/11/2005

Discussion

Is pair programming a good idea? Under what conditions can it be or vice versa?

Do you really believe XP can solve dynamic requirements problem?

Do you think involving the customer into the development area is a good idea?

What are the (possible) pros and cons of XP? If you were a project manager what would

you consider before adopting XP?

Thank you…

Any questions?