22
Code Katas Practicing Your Craft Mike Clement @mdclement [email protected] http:// blog.softwareontheside.com

Code Katas Spring 2012

Embed Size (px)

Citation preview

Page 1: Code Katas Spring 2012

Code Katas

Practicing Your CraftMike Clement@mdclement

[email protected]://blog.softwareontheside.com

Page 2: Code Katas Spring 2012

“Often the true value of a thing isn’t the

thing itself, but instead is the activity that

created it.”-Dave Thomas

Page 3: Code Katas Spring 2012

Chad Fowler on Practice

“As a musician, I might spend a significant portion of my practice schedule playing things that nobody would want to listen to…. I would certainly never record them and release them on a CD. I wouldn’t even bore anyone with these sounds unless they either lived in my house and had no choice or were being paid to listen to them and offer suggestions for improvement. This is an example of “work” in which the action is far more valuable than the direct output.”

http://chadfowler.com/2003/03/25/valueless-software

Page 4: Code Katas Spring 2012
Page 5: Code Katas Spring 2012

BUT I “PRACTICE” ON THE JOB!The Lie

Page 6: Code Katas Spring 2012

Dave Thomas on Practice

“It’s like taking a group of fit kids and telling them that they have four quarters to beat the Redskins (hey, we manage by objectives, right?). In software we do our practicing on the job, and that’s why we make mistakes on the job. We need to find ways of splitting the practice from the profession. We need practice sessions.”

http://codekata.pragprog.com/2007/01/code_kata_backg.html

Page 7: Code Katas Spring 2012

Dave Thomas’s Keys to Practice

•Pressure Off•Learn how to play with code

http://www.codekata.com/2007/01/code_katahow_it.html

Fundamentally incompatible with “on

the job”!

Page 8: Code Katas Spring 2012

CERAMICSQuantity or Quality?

Page 9: Code Katas Spring 2012

Shu Ha Ri

• 守 Shu – House of Laws; to abide by, to defend• 破 Ha – Stone; to break• 離 Ri – Bird; to leave, to depart• Similar to Dryfus model

– Novice, Advanced Beginner, Competent, Proficient, Expert

• Similar to Apprentice model– Apprentice, Craftsman, Master

Page 10: Code Katas Spring 2012

I’M SO SMARTThe rush past 守 (Shu)

Page 11: Code Katas Spring 2012

So what arekatas?

Page 12: Code Katas Spring 2012

Code Katas are Shu

Slow down!

Page 13: Code Katas Spring 2012

KATAS AREN’T THE ONE TRUE PRACTICE?

Other forms of practice

Page 14: Code Katas Spring 2012

Solo Randori?

• Often referred to as “Katas”• Outline a problem, but don’t outline solution• More of a way to discover different paths• 破 Ha• Can lead to new Katas

Page 15: Code Katas Spring 2012

Group Randori

• Free-style practice• “chaos taking” or “grasping

freedom”• Contrast with Katas• “defends against multiple

attackers in quick succession without knowing how they will attack or in what order”

http://en.wikipedia.org/wiki/Randori

• Pair Programming• Use TDD• Start from scratch• Everyone should be following• Pair should be explaining• Audience gives suggestions

only with when Green• Example at

http://vimeo.com/2499540

http://codingdojo.org/cgi-bin/wiki.pl?RandoriKata

Page 16: Code Katas Spring 2012

Koans

• Koans are questions without absolute answers which are used to break down assumptions and reveal underlying truths

• http://rubykoans.com/

Page 17: Code Katas Spring 2012

Code Retreat

• Problem: Conway's Game of Life• Length of Session: 45 minutes• Duration: 8.30am to 5 or 6pm• Pair-programming is necessary, as the knowledge transfer

contained in that activity is essential to the practice• Prefer using Test-Driven Development (TDD)• After each session, pairs should be swapped• After each session, code must be deleted, not put in a

branch, not stashed, just deleted with no trace left

http://coderetreat.com/facilitation.html

Page 18: Code Katas Spring 2012

LET’S TRY IT OUTGuided or Prepared Kata

Page 19: Code Katas Spring 2012

“Often the true value of a thing isn’t the

thing itself, but instead is the activity that

created it.”-Dave Thomas

Page 20: Code Katas Spring 2012

Kata Lists

• http://codingdojo.org/cgi-bin/wiki.pl?KataCatalogue

• http://codekata.pragprog.com/2007/01/code_kata_backg.html

• http://stackoverflow.com/questions/44533/your-favorite-code-kata

• http://www.katacasts.com/• http://katas.softwarecraftsmanship.org/

Page 21: Code Katas Spring 2012

Action Items!

• Repeat this kata at least once a day for a week or two. Memorize and perfect it!

• Find other Katas that are useful to you• Share Katas with your friends and co-workers– Lead a guided Kata session at work

• Explore other forms of practice– Come to my Randori session after lunch (1:30pm)

• Attend the Utah Software Craftsmanship Group!• Practice, Practice, Practice!

Page 22: Code Katas Spring 2012

Me

• @mdclement• [email protected]• http://blog.softwareontheside.com• Utah Software Craftsmanship Group– https://groups.google.com/forum/#!

forum/ut-software-craftsmanship– @utahsc– First Wednesday, Neumont, Room 300