Code Katas Practicing Your Craft Mike Clement @mdclement [email protected] http:// blog.softwareontheside.com
May 06, 2015
Code Katas
Practicing Your CraftMike Clement@mdclement
[email protected]://blog.softwareontheside.com
“Often the true value of a thing isn’t the
thing itself, but instead is the activity that
created it.”-Dave Thomas
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
BUT I “PRACTICE” ON THE JOB!The Lie
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
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”!
CERAMICSQuantity or Quality?
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
I’M SO SMARTThe rush past 守 (Shu)
So what arekatas?
Code Katas are Shu
Slow down!
KATAS AREN’T THE ONE TRUE PRACTICE?
Other forms of practice
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
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
Koans
• Koans are questions without absolute answers which are used to break down assumptions and reveal underlying truths
• http://rubykoans.com/
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
LET’S TRY IT OUTGuided or Prepared Kata
“Often the true value of a thing isn’t the
thing itself, but instead is the activity that
created it.”-Dave Thomas
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/
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!
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