Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by...

17
Extreme programming (XP) • Variant of agile • Takes commonsense practices to extreme levels © 2012 by Václav Rajlich 1

Transcript of Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by...

Page 1: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Extreme programming (XP)

• Variant of agile• Takes commonsense practices to extreme

levels

© 2012 by Václav Rajlich 1

Page 2: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

XP

– if code reviews are good, review code all the time (pairs)– if testing is good, test all the time – if simplicity is good, design with the simplest design that

supports its current functionality– if architecture is important, everybody works on defining

and refining the architecture all the time– if integration testing is important, integrate and test

several times a day– if short iterations are good, make the iterations very short

© 2012 by Václav Rajlich 2

Page 3: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

12 Practices

• The planning game (scope of the next release). • Small releases – simple system into production quickly• Metaphor – simple shared story of how the system works• Simple design – design simply, remove complexity• Testing – by developers and customers• Refactoring• Pair programming• Collective ownership• Continuous integration• 40-hour week• On-site customer• Coding standards – communication through code

© 2012 by Václav Rajlich 3

Page 4: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

The planning game

• Business decisions– scope: which “stories” should be developed– priority of stories– composition of releases– release dates

• Technical decisions– time estimates for features/stories– elaborate consequences of business decisions– team organization and process– scheduling

© 2012 by Václav Rajlich 4

Page 5: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Simple design

• The “right” design– no code duplication– fewest possible classes and methods– fulfills all current business requirements– design for today not the future

© 2012 by Václav Rajlich 5

Page 6: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Small releases • Put system into production ASAP

– fast feedback• Deliver valuable features first• Short cycle time

– planning 1-2 months is easier than planning 6-12 months • Releases should be

– as small as possible– containing the most valuable business requirements– "coherent" (you can't release just for the sake of releasing)

© 2012 by Václav Rajlich 6

Page 7: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Metaphor

• Metaphor– for example, the ATM, the contract– metaphor as shared verbal vision of architecture

• architecture is boxes and connection• metaphor is holistic, and can be communicated

• How does the whole system work?• What is the overall idea of the system?

© 2012 by Václav Rajlich 7

Page 8: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Pair programming

• “All production code is written with two people looking at one machine”– Person 1: Implements the method– Person 2: Thinks strategically about potential improvements, test

cases, issues• Pairs change all the time• Advantages

– no single expert on any part of the system– training on the job– permanent inspections

• Problems:– wasted development time?– pairs need to function

© 2012 by Václav Rajlich 8

Page 9: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Testing

• Automatic test drivers• Write tests before production code

– unit tests developer– feature/acceptance tests customer

• Strong emphasis on regression testing– unit tests need to execute all the time– tests for completed features need to execute all the time

• Unit tests pass 100%

© 2012 by Václav Rajlich 9

Page 10: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

RefactoringRefactoring• Refactoring is changing the internal structure of the code

without changing functionality• Examples:

– remove duplicate code– leverage existing code– remove unused code

• Refactoring mercilessly requires good unit tests and functional tests that can easily be executed

• Goal: Keep design simple– change bad design when you find it– remove dead code

© 2012 by Václav Rajlich 10

Page 11: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Collective Ownership

• Nobody owns code• Nobody owns design• Everybody takes responsibility for the whole of the system

– not everyone knows every part equally well, but• everybody knows something about every part• everybody knows who to ask

– anybody can change or improve anything at any time

• The two are crucially interrelated– you can't know what's broken or can be improved unless you have the

big picture in your mind

© 2012 by Václav Rajlich 11

Page 12: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Continuous Integration

• Every milestone is an integration milestone• A system of "build the pieces then integrate

them at the last minute"– is classic divide and conquer– is doomed to failure

• Short development cycle with integration at the end of every cycle

© 2012 by Václav Rajlich 12

Page 13: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Continuous Integration

• Integration happens after a few hours of development– Code is released into current baseline on

integration machine– All tests are run– In case of errors:

• Revert to old version• Fix problems

© 2012 by Václav Rajlich 13

Page 14: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

On-site customer

• Many software projects fail because they do not deliver software that meets business needs

• Real customer has to be part of the team– defines business needs– answers questions and resolves issues– prioritizes features

© 2012 by Václav Rajlich 14

Page 15: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Coding standards

• Team has to adopt a coding standard– makes it easier to understand other people’s code– avoids code changes because of syntactic

preferences

© 2012 by Václav Rajlich 15

Page 16: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

40 hour week

• Programming is a hard work• Reasonable amount of time needed for the

rest– excessive hours on a regular basis are

counterproductive• they lead to a drop in productivity

© 2012 by Václav Rajlich 16

Page 17: Extreme programming (XP) Variant of agile Takes commonsense practices to extreme levels © 2012 by Václav Rajlich1.

Summary XP

• XP is a "methodology," which is a set of "practices" or principles around which to develop a process

• The principles are all based around the bigger ideas of flexibility and involvement, and are all interrelated– "Any one practice doesn't stand on its own. They require the other

practices to keep them in balance."– for example, quick simple design can't work unless you

• are able to make changes quickly• have a shared vision of the design• have the big picture in mind

• This may be a methodology for just some (not all) development projects.

© 2012 by Václav Rajlich 17