Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

35
Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik

Transcript of Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

Page 1: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

Extreme Programming (XP)

Eugene Chuvyrov

Gena Pasmanik

Page 2: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

Overview

• Terminology

• Software Engineering

• XP Principles

• XP Implementation

• Code, please

• XP at HP

• Final Thoughts

Page 3: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

► Terminology

■ Software Engineering

■ XP Principles

■ XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

We are uncovering better ways of developing software by doing it and helping others do it. Through this work we have come to value:

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

That is, while there is value in the items on the right, we value the items on the left more.

Kent Beck et al., 2001

Manifesto for Agile Software Development

Page 4: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

► Terminology

■ Software Engineering

■ XP Principles

■ XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Agile Methodologies

XPAgile Methodologies

•Agile methods are adaptive rather than predictive: they welcome change, adapt and thrive on change, even to the point of changing the methodology.

•Agile methods are people-oriented rather than process-oriented: no process will ever make up the skill of the development team

•Agile Methodologies vs. Engineering Methodologies

•From Nothing, to Monumental, to Agile

Page 5: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

► Terminology

■ Software Engineering

■ XP Principles

■ XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Agile Methodologies

•Kent Beck and Ward Cunningham—eXtreme Programming

•Jim Highsmith—”Adaptive Software Development” (a study of complex adaptive systems, commonly referred to as chaos theory)

•Ken Schwaber and Jeff Sutherland—Scrum (30-day sprints, 15-minute scrums)

•Alistair Cockburn—Crystal family of methodologies (consider personnel resources and consequences of error, then choose methodology)

•Open Source Software Development (highly parallelizable debugging, distributed teams, one maintainer)?

•Is RUP an Agile Process? It could be. RUP is a process framework and as such can accommodate a wide variety of processes.

Page 6: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

► Software Engineering

■ XP Principles

■ XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Software Engineering

“A problem that might take a dollar to fix if you found it during requirements analysis might cost thousands to fix in production…”

Page 7: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

► Software Engineering

■ XP Principles

■ XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Software Engineering (cont.)

Circa 1970

• There are two essential steps common to the development of computer programs: analysis and coding

• In order to manage and control all of the intellectual freedom associated with software development, one must introduce several other ‘overhead’ steps, including system requirements definition, software requirements definition, program design, and testing.

Page 8: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

► Software Engineering

■ XP Principles

■ XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Software Engineering (cont.)

“If the cost of change rose slowly over time, you would act completely differently from how you do under assumption that costs rise exponentially…”

Page 9: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

► XP Principles

■ XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

XP Values and Principles

•Civilized modern society deals with short-sightedness of individualistic goal-setting by adapting a set of values, backed by myths, rituals, punishments, and rewards…

•Value system is what differentiates XP from “code and fix” development, makes it a discipline

•Values of XP are

•Communication—we will employ many practices that simply will not function without communication

•Simplicity—we will make a bet that it is better to do a simple thing today and pay a little more tomorrow if we need to change it

•Feedback—we will conquer the “occupational hazard of programming (optimism).”

•Courage—we will redesign, and we will throw code away

Page 10: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

► XP Principles

■ XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

XP Values and Principles

•From values to principles

•Rapid feedback—Pavlov’s Dog

•Assume simplicity—do today’s job today and trust your ability to add complexity in the future

•Incremental change

•Quality work—”excellent” or “insanely excellent”

•Playing to win vs. playing not to lose

Page 11: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

XP Implementation

1. Pick your worst problem

2. Solve it the XP way

3. When it’s no longer your worst problem, repeat

-1. Rearrange the furniture so you can pair program and the customer can sit with you

0. Buy some pizza!

What is the XP way?

Page 12: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

XP Implementation

• 12 Core Practices

Testing

RefactoringPair Programming

40-hour weekContinuous Integration

On-site customerPlanning Game

Metaphor

Simple Design

Small Releases

Coding Standards

Collective Ownership

Page 13: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

XP Implementation

• Requirements and Planning• Planning game

• Metaphor

• Construction• Small releases

• Simple design

• Testing

• Quality Assurance• Refactoring

• Pair programming

• Collective ownership

• Project Management• Continuous integration

• 40-hour week

• On-site customer

• Coding standards

Page 14: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

R&P: Planning Game

• Addresses two questions:

• Predicting what will be accomplished by the due date

• Determining what do to next

• Encourages user stories

Page 15: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

R&P: Metaphor

• Guides all development with a simple shared story of how the whole system works

• Expresses the evolving project vision that defines the system’s scope and purpose

Page 16: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Construction: Small Releases

• XP Teams practice small releases in two important ways:

• The team releases running, tested software, delivering business value chosen by the Customer, every iteration

• The team releases to their end users frequently

Page 17: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Construction: Simple Design

• Discourages complexity by helping the team deliver a system that meets the customer’s immediate needs – no more, no less

• Encourages developers to write components with the fewest possible classes and methods, implementing only the functional features a customer has described in a story

• NO Duplicate logic!

Page 18: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Construction: Testing

• Testing is continuous!

• Every single one of the programmer tests must run correctly (100% all the time)

• Programmers get immediate feedback on how they are doing

Page 19: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Quality Assurance: Refactoring

• Process of restructuring the system to remove duplication, simplify code, and add flexibility without changing how the code operates

• Martin Fowler defines refactoring as“set of techniques for identifying and improving bad code, weeding out unnecessary code, and keeping the project as simple as possible

Page 20: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Quality Assurance: Pair Programming

• Two programmers sit side by side at the same machine

• Ensures that all production code is reviewed by at least one other programmer

• Results in better testing and better code

• Two heads really are better than one!

• Serves to communicate knowledge throughout the team

• Goal: to promote collective ownership

Page 21: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Quality Assurance: Collective Ownership

• Every team member becomes familiar with all the project code

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

• Benefits:

• Increases code quality and reduces defects

• Spreads knowledge throughout the team

• Last-minute changes become a team effort, not an individual workload crisis

Page 22: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Project Management: Continuous Integration

• Build multiple times per day (or daily)

• Simplifies integration process

• Infrequent integration leads to serious problems on a software project

• Often delegated to people who are not familiar with the whole system

• Infrequently integrated code is often buggy

• Leads to long code freezes

Page 23: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Project Management: 40-hour week

• Highly encouraged!

• Kent Beck states “It’s OK to work overtime when it’s required, but don’t do it two weeks in a row.”

• If developers can’t get the job done in 40-hour weeks, something is wrong with the process

Page 24: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Project Management: On-Site Customer

• Real customer who works with the team and is available to answer questions, resolve issues, and set priorities

• Remains with the team throughout the project

Page 25: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

Project Management: Coding Standards

• Programmers must follow a common coding standard so that all the code appears to have been written by one person

• Specifics of the standard - not important

• Key: all the code looks familiar to all developers in support of collective ownership

Page 26: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

XP Implementation

• The evolution of the Waterfall model (a) and its long development cycles to the shorter, iterative development cycles (b) to XP’s blending of all these activities, a little at a time, throughout the entire software development process

Page 27: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

► XP Implementation

■ Code, please

■ XP at HP

■ Final Thoughts

XP Implementation

• Start with one practice, and

-1. Set up a bullpen

0. Buy pizza and snacks

1. Pick the worst problem

2. Apply the practice

3. Repeat when solved

• Let’s start with Testing

• Unit tests are written by programmers

• Acceptance tests are written by end users

• Other types of tests can be considered

• Parallel tests

• Stress tests

• Monkey tests

Page 28: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

■ XP Implementation

► Code, please

■ XP at HP

■ Final Thoughts

Code, please

•No code has been written yet

•How can we write automated tests

•Unit tests

•Acceptance Tests

Page 29: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

■ XP Implementation

► Code, please

■ XP at HP

■ Final Thoughts

Code, please

•First, we will utilize “intentional programming”—we will trust our abilities to make the test pass by writing code that conforms to the structure implied by the test

•Second, we will use the MOCK OBJECT pattern to write an automated unit test—we will insert interface between all collaborators of PAYROLL and create test stubs that implement these interfaces

Page 30: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

■ XP Implementation

► Code, please

■ XP at HP

■ Final Thoughts

Code, please

public void testPayroll()

{

MockEmployeeDatabase db=new MockEmployeeDatabase();

MockCheckWriter w=new MockCheckWriter();

Payroll p=new Payroll(db, w);

p.payEmployees();

assert(w.checksWereWrittenCorrectly());

assert(db.paymentsWerePostedCorrectly());

}

Page 31: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

■ XP Implementation

► Code, please

■ XP at HP

■ Final Thoughts

Code, please

•Example of acceptance test, written by customers:

•In testdata.txt file we have:

AddEmp 1429 “Robert Martin” 3215.88

PayDay

VerifyPaycheck EmpID 1429 GrossPay 3215.88

•An XML data structure can be defined to automate multiple tests, including the monkey tests

Page 32: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

■ XP Implementation

■ Code, please

► XP at HP

■ Final Thoughts

XP at HP

•Implementation of internal payroll

management system

•“We gathered together and shared what

we knew about eXtreme Programming”

•“In the end, around 40 % of code written

was to support automated tests

•“Automated Testing was, perhaps, the single

most important decision we ever made on this project.”

Page 33: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

■ XP Implementation

■ Code, please

■ XP at HP

► Final Thoughts

XP at HP

•"Kent Beck, who wrote the first book on extreme programming, is a computing rock star and provocateur. Referred to by several colleagues as 'the most brilliant programmer I know' and admired by coders all over the map, he's as open and eager as a kid. The bibliography of Extreme Programming Explained, his 2000 book that introduced the 12 rules, includes The Structure of Scientific Revolutions, The Athletic Skier."

Matt Stephens , “Extreme Programming Refactored: The Case against XP “

“Some practices, such as pair programming, have not been validated for their efficiency and are promoted based on anecdotal evidence.”

AVOCA Gmbh, “Extreme Programming Considered Harmful”

Page 34: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

■ Terminology

■ Software Engineering

■ XP Principles

■ XP Implementation

■ Code, please

■ XP at HP

► Final Thoughts

Final Thoughts

• When NOT to use Agile Principles

• A team of over 40 people

• Fixed price, or more correctly a fixed scope, contract

• XP is here and it already has a good track record. Consider it for some of the development efforts.

Page 35: Extreme Programming (XP) Eugene Chuvyrov Gena Pasmanik.

References

• Beck, Kent. Extreme Programming Explained: Embrace Change.

• Beck, Kent. “Embracing Change with Extreme Programming.” Computer. October 1999, pp. 70-77.

• Martin, Robert. Agile Software Development, Principles, Patterns, and Practices.

• Muller M., Tichy W. “Case Study: Extreme Programming in University Environment.” 23rd International Conference on Software Engineering (ICSE ’01). May 2001, pp. 0537.

• Murru O., Deias R., Mugheddu G. “Assessing XP at a European Internet Company.” IEEE Software. May 2003, pp. 37-43.

• Padberg, Frank. “Analyzing the Cost and Benefit of Pair Programming.” Ninth International Software Metrics Symposium . Sept. 2003, pp. 166.

• Dr. Dobb's Journal. “Mission-Critical Development with XP & Agile Processes.” January 2004

• http://www.martinfowler.com/articles/newMethodology.html#N4001F4

• http://www.avoca-vsm.com/Dateien-Download/ExtremeProgramming.pdf

• http://www.wired.com/wired/archive/11.09/xmen.html

• http://www.xprogramming.com

• http://www.extremeprogramming.org