XP Extreme Programming Joint Advanced Student School (JASS) EXTREME PROGRAMMING

advertisement
XP
Extreme Programming
XP
EXTREME PROGRAMMING
Joint Advanced Student School (JASS)
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
■
■
■
■
■
■
■
■
What is XP?
Motivation
XP values
XP features
Rules and practices of XP
Example: Pair Programming
Conclusion
Experiment: Pair Drawing
JASS 2006, Sergey Konovalov, Stefan Misslinger
Outline
XP
What is XP?
A system of practices that a community of
software developers is evolving to address the
problems of quickly delivering quality
software, and then evolving it to meet
changing business needs.
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
JASS 2006, Sergey Konovalov, Stefan Misslinger
Extreme?
XP

Motivation
Why do we need XP?
Common problems of
software development:
XP solutions:

Schedule slips

Short iterations, fast delivery

Business misunderstood

Whole team

Defect rate

Test driven development

Management

Shared understanding

Motivation of developers

Humanity and productivity
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP

Motivation
Economics of Software Development
Classic approach
XP approach
Cost of change
Cost of change
Production
Testing
Implementation
Design
Analysis
Requirements
Time
JASS 2006, Sergey Konovalov, Stefan Misslinger
Time
Iterations
XP
XP values
Communication
Courage
Simplicity
Feedback
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP

XP features
XP is the most suitable for:




Small and medium size projects
New technologies
Projects with unclear requirements
Risky projects

XP improves skills by cross training

No more than 20 developers in a team

Using of XP in life-critical projects is
questionable
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Rules and practices
Planning
Designing
Extreme Programming
Coding
Testing
http://www.extremeprogramming.org
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
The planning game
Desired features
User stories
Determine Project
Velocity
Development
Estimate stories
Prioritize
Plan overall release
Plan next iteration
JASS 2006, Sergey Konovalov, Stefan Misslinger
Business
Business
Development
Business
Business
Development
XP
Designing
The
metaphor
is
TheSimple
metaphor
is aa simple
simple
program
to
Always
use
the
simplest
meaningful
description
meaningful
description of
of
explore
potential
possible
design
how
the
program
works.
how
the
program
works.
solutions.
Address
only
Ongoing
redesign
of
that gets the job done.
one
problem
at a time.
software
to improve
responsiveness to
K.I.S.S.
change
- Keep It Short and Simple
JASS 2006, Sergey Konovalov, Stefan Misslinger
■
Simplicity
System metaphor
■
Spike solution
■
Refactoring
■
XP
The customer is always
available.
Code must
be written to
Any developer can
agreed standards.
change
any
line
of
code
40-Hour Work Week
to
add
Javafunctionality,
Naming Conventions fix
Programmers go home
bugs,
or
refactor.
Classes:
Node, Reader,
AssignableVariable
on time.
Coding
■
On-site customer
Collective ownership
■
Pair programming
■
Coding standards
■
No overtime
■
Variables: node, reader, variable
Member variables: m_imageSource, m_reader;
Methods: append(), getSource(), deleteIfEmpty()
Mutator Methods: setToyOwner(String ownerName)
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Testing
■
Extreme testing?
Code test first
■
Unit tests
■
Acceptance tests
■
Testcase is the
specification
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Pair Programming
Example
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Example
Let me see... Our cards says,
do
And
weiscreating
calculate
our
how?
task?price
that?
The
depends
on the number of days
Nice, so letsHow
startWhat
with
'customer'
We have
thataWait!
regular
to calculate
Letmovies
us class.
write
theare
fee
a 2EUR
testcase
for thefor
rented
for2 it...
days.
DVDs.
that you rent a DVD.
After the third day it's 1.5EUR per day.
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
public class CustomerTest extends
junit.framework.TestCase
{
public CustomerTest(String name)
{
super(name);
}
}
JASS 2006, Sergey Konovalov, Stefan Misslinger
Example
XP
Example
The best thing is, that we write a testcase-method
Good, let'stestRentingOneMovie,
write down what we have which checks the renting-fee
so far. First we need a customer. And then we act
the
movie.
The
framework
looks
for
allday
methods
And where
What'sfor
That's
do
And
the
we
first
how?
easy
put
testcase?
the
:)every
testcode?
For
Right.
The
We
method
simplest
rent awe
DVD
thing
write
for
to
asserts
one
start
isto assure
and that
like we have all the methods
begin the
with
'test'
and
runs
them.
renting
fee
that
should
it is
one
working.
be
movie.
2 EUR.
that we'd like to have.
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Example
public class CustomerTest...
public void testRentingOneMovie() {
Customer customer = new Customer();
customer.rentMovie(1);
assertTrue(customer.getTotalCharge() == 2);
}
}
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Example
Ok. You want me to make this test running
That's also easyExactly.
:)
What would you do, if you
and forget everything else for the moment.
only had to implement this single test?
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Example
public class Customer {
public void rentMovie(int daysRented) {
}
public int getTotalCharge() {
return 2;
}
}
How extreme... But good :)
Test a bit, code a bit, test a bit more
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Example
public class CustomerTest...
public void testRentingTwoMovies() {
Customer customer = new Customer();
customer.rentMovie(1);
customer.rentMovie(2);
assertEquals(4, customer.getTotalCharge());
}
}
How extreme... But good :)
Test a bit, code a bit, test a bit more
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Example
public class Customer {
private int totalCharge = 0;
public void rentMovie(int daysRented) {
totalCharge += 2;
}
public int getTotalCharge() {
return totalCharge;
}
}
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Conclusion
What you should take with you now
■
Communicate intensively
Test a bit, code a bit, test a bit more
■
Keep the design simple
■
Refactor
■
Enjoy having a safety net when refactoring
■
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
Have fun and thank you!
JASS 2006, Sergey Konovalov, Stefan Misslinger
XP
■
■
■
■
■
Experiment: Pair Drawing
How did you feel when you were drawing solo vs.
in a pair?
Which of the drawings are more artistic / original?
Did you find yourself concentrating more or less
during pairing?
Was it more fun to draw alone or in a pair?
What did you like and what didn’t you like about
drawing alone or in a pair?
http://industriallogic.com/games/pairdraw.html
JASS 2006, Sergey Konovalov, Stefan Misslinger
Download