A n Intro d u c tio n to
E xtrem e Pro gra m m i n g
Ken Auer
[email protected] http://www.rolemodelsoft.com
RoleModel Software, Inc. 5004 Rossmore Dr. Fuquay-Varina, NC 27526
919-557-6352
T h e J o y of S oft w ar e
❑ T o c h a n g e H ar d w ar e ➢ S ol d erin g Iro n ➢ S cr e w driv ers ➢ C h a n g e P C B ❑ T o c h a n g e S oft w ar e ➢ J u st c h a n g e s o m e s y m b o lsT h e R e ality? of Soft w are
❑ C h a n gi n g S oft w ar e is H ar d ➢ D e p e n d e n cie s Cost of Making Changes TimeT h e Pr o m i s e of S p e cificatio n s
❑ E x a m pl e s fro m Tra ditio n al
E n gi n e erin g
➢ D o th e Dr a win g s first
➢ D e sig n w or k is d o n e o n th e dra wi n g s
➢ C o n str u ction is a se p ara te act (at lea st in th e or y)
❑ In S oft w are
➢ C a pt ure R e q uire m e nts up fro nt
➢ D o d e sig n u p fro nt
B D U F ( B ig D e sig n U p Fr o nt)
Cost of Making Changes
Time
Analysis Design Coding Testing
Find errors faster
❑ Al m o st all m e t h o d( olo gie)s fo c u s o n
this as s u m p tio n n o m a tter w h at th e y s a y a b o ut the e vils of w aterfalls!
T h e U n c o m f orta b le R e ality
❑ T h e C u st o m e r s c h a n g e re q uirem e nt s
➢ C u st o m ers believ e s oft w are is ea s y to c h a n g e
➢ R e al re q uirem e nt s h ar d to n ail d o w n
➢ T h e y’re learnin g, c o n ditio n s c h a n g e
❑ H a r d t o g e t c o sts of fe at ure s
➢ M at erials ke e p c h a n gin g
➢ P r o d u ctivity of p e o ple/tea m s v ary wid ely
➢ L at er d e v elo p m e nt tas k s h ar d t o estim at e
❑ D e v el o p ers lear n a s the y pr o gra m
❑ T o o m u c h flexibility c o sts
D e si g n D e cisio n s
❑ In th e m o m e nt
➢ C o n sid er c u rre nt n e e d s
➢ P atc h c o d e w h e n n e w n e e d s a p p e ar… is this really d e sig n ? ? ?
❑ U p fro nt de sig n
➢ C o n sid er c u rre nt n e e d s a n d p o s sible future nee d s
➢ D e sig n to mini miz e c h a n g e with future n e e d s
➢ P atc h co d e if u nforese e n nee d ap p e a rs
❑ E v ol utio n a ry d e sig n
➢ C o n sid er c u rre nt n e e d s a n d p o s sible future nee d s
➢ T ra d e off c o st of c urre nt flexibility vers u s c o st of later refa ctorin g
O bj e ct O rie ntation
O bject-orie ntatio n helps m a n a g e the c o m pl e xity of s oft w ar e a n d red u c e d e p e n d e n cie s …
W h y d o n’t m e t h o d s reflect this? W h y d o n’t m e t h o d s ex ploit this?
M a n y h a v e trie d b ut faile d b e c a u s e th e y thre w o ut th e b a b y (disciplin e) w h e n
A n ot h er A p p r o a c h
Cost of Making Changes Time Reduce cost of later change❑ T h e flatter this is, the les s...
➢ B e n efit of u p -fro nt d e sig n
➢ C o st of u p-fro nt d e sig n
E xtre m e Pr o gr a m m i n g
“ R e c o g nizin g th at the c o st of c h a n gi n g a pr o gr a m n o lo n g er
gr o w s e x p o n e ntially o v er ti m e, X P relies o n th e c o m pl e x intera ctio n s b et w e e n sim pl e d e v e lo p m e nt
pr a ctic e s to re d u c e p roje ct risk,
i m pr o v e res p o n siv e n e s s to b u s ine s s a n d te c h nic al lear nin g, a n d m a k e
pr o gr a m m in g m or e fu n ”
- K e nt B e c k
Pl a yin g to Wi n
❑ D o n’t just “ s ur viv e”
❑ T a c kle pr o bl e m s a g g re s siv ely
❑ T a c kle o nly th e pr o ble m s th at yo u
K N O W e xist in the curre nt co n text
❑ C o m m u nic ate to e x p o s e a n d
re d u c e risk
❑ B e c o nfid e nt in w h at y o u’ v e d o n e a n d ar e d oin g b a s e d o n fe e d b a c k
T h e F o ur Valu e s
❑ Si m plicity
❑ C o m m u nic atio n
❑ F e e d b a c k
Si m plicity
❑ W h at is the si m ple st thin g th at will
p o s sibly w or k ?
❑ N o c o d e d u plicatio n
❑ D o n’t lo o k to o far a h e a d …
➢ Si m ple thin g s are e a sier to c h a n g e
C o m m u n icatio n
❑ P e o ple talk to p e o ple
❑ P e o pl e w o rk wit h p e o ple ❑ P e o ple are h o n e st w h e n th e y d o n’t k n o w ❑ P e o pl e s h ar e w h at th e y’v e lea r n e d! ❑ C o d e c o m m u ni c ate s with p e o p le ❑ N o d o c u m e ntatio n for d o c u m e ntatio n’s s a k e
F e e d b a c k
❑ M e a s ur e thi n g s th at m a tter
❑ L o o k at the m e a s ur e m e nt s
❑ S h ar e th e m e a s ur e m e nts
❑ B elie v e the m e a s ur e m e nt s tell y o u s o m et hin g
❑ C h a n g e w h at y o u c a n,
A g g r e s siv e n e s s
❑ Y o u’v e g ot to b elie v e that y o u c a n d o it
❑ J u m p into the pr o blem , d o n’t be froze n
b y all th e thi n g s th at c a n g o wro n g
❑ B elie v e that w h e n thin g s d o g o wr o n g,
X P Iteratio n s
❑ Li mit e d U p Fr o nt D e si g n
➢ D etaile d w ork in iteratio n s
➢ U p fro nt w ork for esti m ate s a n d risk a s s e s s m e nt
❑ Pla n ni n g G a m e
➢ C u st o m er s de v elo p storie s (us e c a s e s)
➢ D e v elo p m e n t esti m ate s stories
➢ J oint sc h e d ulin g b a s e d o n c u st o m er valu e a n d d e v elo p m e nt risk
❑ Di s ciplin e d d e v elo p m e nt
➢ W rite tests first
➢ O nly fo c u s o n story in h a n d
D e v el o p m e nt Pr a ctic e s
A D a y in th e Life... ©
A D a y In T h e Life
❑ St a n d u p m e etin g
❑ L o a d late s t stuff
❑ Ide ntify tas k s
❑ P air u p
❑ T e st first, c o d e s e c o n d ➢ W h at e xists?
➢ D o e s it su p p ort w h at w e n e e d to d o ?
➢ G otta test for that?
➢ D o th e tests w o r k ?
➢ Is the c o d e clea n (e n o u g h) ?
❑ If it’s w or k in g, inte grate it
D e v el o p m e nt Pr a ctic e s
A Little M o re D etail ©
S plit B u s ine s s & T e c h nic a l
❑ C u st o m er
➢ c h o o s e s sc o p e
➢ s ets priorities
❑ D e v el o p ers
➢ e sti m ate ti m e re q uire d to i m ple m e nt re q uire m e nts
S m all R e lea s e s
❑ C u st o m er
➢ c h o o s e s s m allest, m o st v alu a ble set of re q uire m e nts to p ut into pr o d u ctio n n e xt
❑ D e v el o p ers
➢ k e e p d e sig n si m ple to g e t re q uire m e n ts m et as fast as p o s sible
M e t a p h o r
❑ E v er y o n e tells th e stor y of the s y ste m
c o n siste nt with a c e n tral m eta p h or
❑ V alidate the m eta p h o r quickly with a
c o n cr ete de sig n
Si m pl e D e si g n
❑ A t all ti m e s th e s y ste m h a s
➢ si m ple st d e s ign th at ru n s all test ca s e s
➢ n o c o d e d u p licatio n
➢ n o u n n e c e s s ary clas s e s or m et h o d s
❑ C o n st a ntly e v olv e d thr o u g h
H a vi n g T e st s
❑ D e v el o p ers
➢ w rite a n d satisfy u nit tests for all d e v elo p m e n t
➢ w rite the tes ts first
❑ C u st o m er s/T e sters
➢ w rite fu n ction al tests for e a c h re q uirem e nt
❑ E n s ur e all tests c a n b e ru n with o n e
c o m m a n d
❑ T e st ofte n …
e v er y c h a n g e to a lin e of c o d e ? ?
❑ R u n all tests with e v e ry b uild
H a vi n g T e st s
❑ T a k e th e co nfid e n c e of th e m o m e nt, a n d pr e s erv e it ❑ W h e n did it bre a k ? ❑ Allo w s ➢ refa ctorin g➢ c ollective c o d e o w n ers hip
➢ fee d b a c k
P air Pr o gr a m m i n g
❑ All Pr o d u c tio n C o d e …
➢ w ritte n with tw o p e o ple sittin g at o n e m a c hi n e ➢ p a s s th e ke y b o ar d a n d m o u s e b a c k an d forth ❑ R ef a ct oring c o d e w h er e v er it ne e d s cle a n u p ❑ W rite te sts ❑ E v er y o n e k n o w s a little a b o ut th e w h ol e s y ste m
R ef a ct orin g
❑ P air brin g s c o d e b a c k to si m p licity th e
insta nt th e y s e e it driftin g a w a y
C o ntin u o u s Integr atio n
❑ S y ste m is b uilt a n d su c c e s sf ully
teste d s e v er al ti m e s a d a y
➢ e a c h ti m e a p air g et s th e test ca s e s for a si m ple d e v elo p m e nt tas k ru n ni n g
C olle ctive C o d e O w n e r s h ip
❑ C o d e is fixe d w h er e v er it is fo u n d to
b e d eficient
❑ T e sts v erify y o u h a v e n’t br o k e n a n yt hin g
Iteratio n s
❑ D u rin g Iteratio n Pla n ni n g
➢ C ar d s c a n b e s hifte d
➢ Ti m e c a n n ot
❑ D u rin g Iteratio n
➢ Clarificatio n a s w e lear n
Fi n al T h o u g ht s
❑ U n dis ciplin e d c o di n g lea d s to a ste e p
c o st of c h a n g e c ur v e
❑ B D U F d o e s n’t c h a n g e th e c ur v e
➢ It atte m pts to re d u c e n u m b er of ti m e s y o u are bitte n b y the c urv e
➢ It ad d s u p fro nt c o st that m a y n e v er be rec o v er e d ❑ X P fo c u s e s o n p u s hin g th e “ c o st of ch a n g e ” c u rv e d o w n ❑ A n y of th e X P pr a ctic e s mi g ht h el p y o ur pr oject
❑ A d o ptin g all of th e p ra ctic e s will allo w
y o u to attain a hig h le v el of
pr o d u ctivity a n d pr o d u c e hig h q u ality pr o d u ct at a s u staine d rate o v er a n e xte n d e d p erio d of ti m e
T o L e ar n M or e...
❑ http://w w w. arm aties.c o m
❑ http://c2.c o m/c gi/ wiki? E xtrem e P r o gr a m m i n g R o a d m a p
❑ B o o k s fr o m A W - L:
➢ E xtre m e Pr o g ra m m i n g E x plain e d: E m b r a c e C h a n g e
K e n t B e c k
➢ R e fact orin g: I m pr o vin g the D e s ig n of E xistin g C o d e
M a rtin F o wler
➢ E xtre m e Pr o g ra m m i n g A p plie d: Pla yin g to Wi n
(n ot y et a v aila ble) B e c k, A u e r, C u n nin g h a m, F o w l e r, J effrie s