extreme programming programming practices object mentor, inc. copyright 1998-2000 by object mentor,...

75
Extreme Programming Programming Practices Object Mentor, Inc. Copyright 1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material are Copyright © 2000, by Addison Wesley Longman,Inc. and have been reproduced here with permission. www.objectmentor.com

Upload: barbara-vestal

Post on 14-Dec-2015

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Extreme ProgrammingProgramming Practices

Object Mentor, Inc.

Copyright 1998-2000 by Object Mentor, IncAll Rights Reserved

Portions of this material are Copyright © 2000, by Addison Wesley Longman,Inc. and have been

reproduced here with permission.

www.objectmentor.com

Page 2: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Extreme Programming (XP)

At its core, XP is:

Page 3: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Extreme Programming (XP)

At its core, XP is:Very Short Cycles

Page 4: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Extreme Programming (XP)

At its core, XP is:Very Short Cycles

Intense Feedback

Page 5: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Extreme Programming (XP)

At its core, XP is:Very Short Cycles

Intense Feedback

Networked Communication

Page 6: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

The XP Planning Practices

User Stories

Page 7: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

The XP Planning Practices

User Stories

Release Planning

Page 8: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

The XP Planning Practices

User Stories

Release Planning

Iteration Planning

Page 9: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

The XP Planning Practices

User Stories

Release Planning

Iteration Planning

On Site Customer

Page 10: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

XP Programming Practices

Pair Programming

Test-first Design

Refactoring

Continuous Integration

Collective Ownership

Coding Standard

40 hour week

Page 11: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

XP Programming Practices

Pair Programming

Test-first Design

Refactoring

Continuous Integration

Collective Ownership

Coding Standard

40 hour week

Page 12: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Pair Programming

Two Programmers sit at one workstation

Page 13: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Pair Programming

Two Programmers sit at one workstation

They take turns “driving”

Page 14: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Pair Programming

Two Programmers sit at one workstation

They take turns “driving”

Pairs are short lived

Page 15: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Pair Programming

Two Programmers sit at one workstation

They take turns “driving”

Pairs are short lived

Pairing transmits knowledge to the team

Page 16: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Pair Programming

Two Programmers sit at one workstation

They take turns “driving”

Pairs are short lived

Pairing transmits knowledge to the team

Pairing train newbies

Page 17: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Pairing keeps the pace

When programming alone, you sometimes find yourself working at super speed.

Page 18: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Pairing keeps the pace

When programming alone, you sometimes find yourself working at super speed.

After awhile, you lose focus and drift away in the afterglow.

Page 19: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Pairing keeps the pace

When programming alone, you sometimes find yourself working at super speed.

After awhile, you lose focus and drift away in the afterglow.

Your partner keeps both from happening.

Page 20: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Pair Programming Research

Laurie Williams, http://collaboration.csc.ncsu.edu/laurie/

Findings:Pairs use no more manhours than singles.

Pairs create fewer defects.

Pairs create fewer lines of code.

Pairs enjoy their work more.

Page 21: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

XP Programming Practices

Pair Programming

Test-first Design

Refactoring

Continuous Integration

Collective Ownership

Coding Standard

40 hour week

Page 22: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Test First Design

In Tiny (5 min) cycles

Page 23: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Test First Design

In Tiny (5 min) cyclesWrite a test case.

Page 24: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Test First Design

In Tiny (5 min) cyclesWrite a test case.

Write the code that passes it.

Page 25: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Test First Design

In Tiny (5 min) cyclesWrite a test case.

Write the code that passes it.

Repeat until program does what you want.

Page 26: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Test First Example

import junit.framework.*;public class TestAutoMileageLog extends TestCase{ public TestAutoMileageLog(String name) { super(name); } public void testCreateFuelingStationVisit() { FuelingStationVisit v = new FuelingStationVisit(); }}

Page 27: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Test First Example

import junit.framework.*;public class TestAutoMileageLog extends TestCase{ public TestAutoMileageLog(String name) { super(name); } public void testCreateFuelingStationVisit() { FuelingStationVisit v = new FuelingStationVisit(); }}

public class FuelingStationVisit{}

Page 28: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Test First Example

import junit.framework.*;public class TestAutoMileageLog extends TestCase{ public TestAutoMileageLog(String name) { super(name); } public void testCreateFuelingStationVisit() { FuelingStationVisit v = new FuelingStationVisit(); }}

public class FuelingStationVisit{}

Page 29: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

This may seem useless.

Page 30: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

This may seem useless.

But it shows me that the test framework is functioning properly.

Page 31: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

This may seem useless.

But it shows me that the test framework is functioning properly.

It also gives me a working base to continue from.

Page 32: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

This may seem useless.

But it shows me that the test framework is functioning properly.

It also gives me a working base to continue from.

We move, in tiny steps, from working base, to working base.

Page 33: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Test First Example

public void testCreateFuelingStationVisit() { Date date = new Date(); double fuel = 2.0; // 2 gallons. double cost = 1.87*2; // Price = $1.87 per gallon int mileage = 1000; // odometer reading. double delta = 0.0001; //fp tolerance FuelingStationVisit v = new FuelingStationVisit( date, fuel, cost, mileage); assertEquals(date, v.getDate()); assertEquals(1.87*2, v.getCost(), delta); assertEquals(2, v.getFuel(), delta); assertEquals(1000, v.getMileage()); assertEquals(1.87, v.getPrice(), delta); }

Page 34: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Test First Example

public class FuelingStationVisit { public FuelingStationVisit(Date date, double fuel, double cost, int mileage) { itsDate = date; itsFuel = fuel; itsCost = cost; itsMileage = mileage; } public Date getDate() {return itsDate;} public double getFuel() {return itsFuel;} public double getCost() {return itsCost;} public double getPrice() {return itsCost/itsFuel;} public int getMileage() {return itsMileage;}}

Page 35: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Test First Example

Page 36: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

XUNIT

Lightweight Unit Testing Frameworkwww.junit.org

Junit

Cppunit

Pyunit

Etc.

Page 37: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

XP Programming Practices

Pair Programming

Test-first Design

Refactoring

Continuous Integration

Collective Ownership

Coding Standard

40 hour week

Page 38: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

After getting something to work we refactor.

Page 39: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

After getting something to work we refactor.

Tiny (5 min) improvements

Page 40: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

After getting something to work we refactor.

Tiny (5 min) improvements

Followed by running all the tests.

Page 41: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

After getting something to work we refactor.

Tiny (5 min) improvements

Followed by running all the tests.

Build and test time must be very very fast.

Page 42: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

We cannot check in our code until:

Page 43: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

We cannot check in our code until:All tests are green.

Page 44: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

We cannot check in our code until:All tests are green.

All duplication has been removed

Page 45: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

We cannot check in our code until:All tests are green.

All duplication has been removed

The code is as expressive as we can make it.

Page 46: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

We cannot check in our code until:All tests are green.

All duplication has been removed

The code is as expressive as we can make it.

The code is as simple as we can make it.

Page 47: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

Comments should be minimized

Page 48: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

Comments should be minimizedThey often lie.

Page 49: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

Comments should be minimizedThey often lie.

They are an admission that we could not make our code express our ideas.

Page 50: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Refactoring

Comments should be minimizedThey often lie.

They are an admission that we could not make our code express our ideas.

There are many things you can do to make software more expressive.

Page 51: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

XP Programming Practices

Pair Programming

Test-first Design

Refactoring

Continuous Integration

Collective Ownership

Coding Standard

40 hour week

Page 52: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Continuous Integration

Daily builds are for wimps.

Page 53: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Continuous Integration

Daily builds are for wimps.Build, end to end, at every check in.

Page 54: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Continuous Integration

Daily builds are for wimps.Build, end to end, at every check in.

Check in frequently.

Page 55: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Continuous Integration

Daily builds are for wimps.Build, end to end, at every check in.

Check in frequently.

Put resources on speeding build time.

Page 56: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Continuous Integration

Daily builds are for wimps.Build, end to end, at every check in.

Check in frequently.

Put resources on speeding build time.

Put resources on speeding test time.

Page 57: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

XP Programming Practices

Pair Programming

Test-first Design

Refactoring

Continuous Integration

Collective Ownership

Coding Standard

40 hour week

Page 58: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Collective Ownership

Anyone can improve any part of the code at any time.

Page 59: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Collective Ownership

Anyone can improve any part of the code at any time.

No one acts as the gatekeeper for any part of the code.

Page 60: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Collective Ownership

Anyone can improve any part of the code at any time.

No one acts as the gatekeeper for any part of the code.

This includes schemas…

Page 61: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Collective Ownership

Anyone can improve any part of the code at any time.

No one acts as the gatekeeper for any part of the code.

This includes schemas…

And libraries…

Page 62: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Collective Ownership

Anyone can improve any part of the code at any time.

No one acts as the gatekeeper for any part of the code.

This includes schemas…

And libraries…

And everything else that’s different

Page 63: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

XP Programming Practices

Pair Programming

Test-first Design

Refactoring

Continuous Integration

Collective Ownership

Coding Standard

40 hour week

Page 64: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Coding Standard

A group of conventions that everyone agrees to.

Page 65: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Coding Standard

A group of conventions that everyone agrees to.

Emerges over time.

Page 66: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Coding Standard

A group of conventions that everyone agrees to.

Emerges over time.

Continuously evolves.

Page 67: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

Coding Standard

A group of conventions that everyone agrees to.

Emerges over time.

Continuously evolves.

The team rules.

Page 68: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

XP Programming Practices

Pair Programming

Test-first Design

Refactoring

Continuous Integration

Collective Ownership

Coding Standard

40 hour week

Page 69: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

40 hour week

You can’t do your best when you are tired.

Page 70: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

40 hour week

You can’t do your best when you are tired.

When you don’t do your best, you make messes.

Page 71: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

40 hour week

You can’t do your best when you are tired.

When you don’t do your best, you make messes.

Messes slow everyone down

Page 72: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

40 hour week

You can’t do your best when you are tired.

When you don’t do your best, you make messes.

Messes slow everyone down

So you must be rested.

Page 73: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

40 hour week

You can’t do your best when you are tired.

When you don’t do your best, you make messes.

Messes slow everyone down

So you must be rested

Occasionally, you may work one week of moderate overtime.

Page 74: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

XP Programming Practices

Pair Programming

Test-first Design

Refactoring

Continuous Integration

Collective Ownership

Coding Standard

40 hour week

Page 75: Extreme Programming Programming Practices Object Mentor, Inc. Copyright  1998-2000 by Object Mentor, Inc All Rights Reserved Portions of this material

The End.