
Using Katas to Improve Your Coding - memracom
http://blog.8thlight.com/chong-kim/2013/09/26/using-katas-to-improve.html
======
js2
Counterpoint - [http://simpleprogrammer.com/2013/08/26/dont-code-
katas/](http://simpleprogrammer.com/2013/08/26/dont-code-katas/)

tl;dr: doing the same thing repetitively only improves your skill to a point
after which you need to increase the difficulty of the task if you are to
continue to improve.

~~~
jkscm
The author tries really hard to suggest that when you work on a "code kata"
you will not improve. But there is no drill instructor yelling: "GIVE ME 100
CRUD-WEB APPS, RIGHT NOW!"

"code kata" is just a fancy name for a computational problem that has limited
scope but still provides lots of room for creativity.

Just like a the questions on
[https://projecteuler.net/](https://projecteuler.net/) but with a lesser focus
on number theory.

tl;dr: "code katas" were never intended to be mindlessly repeated but to
deliberately think about what can be faster, better, more elegant, expressive
(name you favorite)

see:
[http://codekata.pragprog.com/codekata/2007/01/code_katahow_i...](http://codekata.pragprog.com/codekata/2007/01/code_katahow_it.html)

~~~
ncphillips
The exact same intention is in martial arts katas.

~~~
adamlett
I believe martial katas were invented as a means for one teacher to teach lots
and lots of students at the same time. Like a lot of things of oriental
origin, they tend to get romanticized in the west.

------
saidajigumi
This kata concept has an interesting dovetail to Jennifer DeWalt's 180
Websites in 180 Days project[1]: repeated skills practice within a set of
constraints.

I _really_ like Chong Kim's idea of using Screenflow to capture these sessions
and be able to review them later, played back at high speed. The opportunity
to "look over my own shoulder" as I'm working a problem, to inspect my
workflow in a manner detached from the moment, seems like an invaluable
training tool. Video review has been used for athletes to improve their skills
for ages now, and has become very accessible right along with smartphones.
Applying those techniques to coding or other knowledge worker skills (work in
Photoshop, etc?) is pretty darn interesting.

[1] Most recently on HN at:
[https://news.ycombinator.com/item?id=6489468](https://news.ycombinator.com/item?id=6489468)

------
dccoolgai
How has no one mentioned codewars yet? This is like the best code kata site on
the web... [http://www.codewars.com](http://www.codewars.com)

~~~
8_hours_ago
I also recommend codewars, it's a very well executed gamification of short
programming challenges. I've been regularly solving problems on it for over a
month and it's been a lot of fun. I had only written a few dozen lines of
Javascript before I started; since then I have become much more proficient.

------
agentultra
I practice kata every day. I typically show up to work 20 - 30 minutes early
and pick a problem to work on. I record my answer for later reflection.
Sometimes I will repeat a solution I came to before, sometimes I will refine
an old approach, and other times I will think of a new way to approach it. I
keep all of my problems that I collect and the solutions I come up with in a
git repository.

Sometimes I will call to mind an interesting solution I came up with. Having
the repository is handy so that I can pull up the problem, the solution I am
interested in and perhaps diff it against a previous, similar solution I had
came up with before. I use this time to reflect on the changes I made, how it
changes the characteristics of the algorithm (time, space, bounds, etc), and
whether it states the intent with more clarity than before. I keep these
reflections in a journal.

I know I've improved when I notice in my journals that my language changes
dramatically from dense, technical language to simple, straight-forward
language without losing any of the accumulated knowledge.

~~~
ternaryoperator
>I know I've improved when I notice in my journals that my language changes...

While what you're doing is admirable--I wish more developers did this--the
central question is not whether you improved, but whether you improved more
than if you'd done other work. For example, learning a new language,
refactoring, etc.

~~~
agentultra
I end up, "refactoring," by consequence of repetition I suppose. There are
some days when I can't think of another way to write a _fibonacci_ function (a
trivial example... without including obfuscated methods, there are only so
many effective ways to implement a function that computes the n-th number of
the sequence). On those days I may end up calling to mind a previous solution
and simply, "refactor it."

I have conflicting feelings about learning new languages. I do it every now
and again but for a craftsperson I don't feel that it is the ideal approach.
As some monks I've heard say so it is with programming: _you can be fluent in
many languages but master none_. Real mastery requires dedication and focus
over time. But that's not the whole story, is it?

I've met too many developers who will put C on their resume under the
assumption that they are capable of writing C programs. More often than not
it's a bold-faced lie, but when it isn't I find they are certainly capable of
writing a C program and getting something to compile. However there are very
few who understand what sequence points are, that still treat the linker like
black magic, and don't fully grasp how array and array pointer parameters are
changed by the compiler.

The point I'm getting at is that C is generally one of many languages on a
programmer's resume. And it's usually an after-thought. However if you really
grill someone on the soup-to-nuts of just one of these languages you can find
holes in their knowledge. They learn enough to get something useful done but
they don't know enough to do truly masterful things with the language. I think
about it like being a musician: you can learn enough about an instrument to
join a jam but to push the boundaries you need to master one. And mastery is
something I find thats consistent, dedicated practice.

As to how to measure whether I could have improved more if I had done
something else other than master one thing... I think there's a lack of bounds
there that should be determined by your goals. If your goal is to join a jam
and play along then you want to learn as little as possible up front and as
much as you can as you go along. I think this is the par for modern
programmers these days. But if your goal is to push what's possible with a
particular instrument then generalizing your knowledge is not nearly as
effective as studying music with that instrument alone. Both are valid
approaches and it's a matter of limiting the scope of possibilities based on
what you want to achieve.

Though mastery tends towards an asymptotic function reaching, but never
achieving, perfection.

------
jessaustin
The kitten experiment seems kind of horrifying, but it certainly conveys the
point.

------
spc476
I did something similar back in January 2012---I wrote the same program 30
different ways in four different languages
([http://boston.conman.org/2012/01/09.1](http://boston.conman.org/2012/01/09.1)
is #1, just follow the links) and it was an interesting experience. Quite a
few only differ in a few lines, or maybe cosmetically, but some versions forgo
standard libraries, or read input in a radically different method, or explore
different programming techniques.

------
hk__2
I use katas to learn new languages [1], but I never do a kata twice. Picking a
problem and solving it with a new language is pretty interesting, especially
when you try it with very different paradigms.

[1] [https://github.com/bfontaine/Katas](https://github.com/bfontaine/Katas)

------
CodeCube
Just to throw a slightly dissenting perspective ... I don't know, I've been
interested in the concept of katas in a sense. I've done them a few times, but
I always seem to have another side project (or three) that I'd rather spend my
extracurricular time on. I guess if you have nothing else to work on katas are
fine, but otherwise, just pour your time into a side-project that you're
passionate about :)

Of course, that's just my viewpoint ... I understand it won't work for
everyone. So YMMV

------
mcphage
I've got a repo of some katas in Ruby on github:
[http://github.com/mark/katas](http://github.com/mark/katas) ... they've
definitely been useful for me to improve, and experiment with new ideas and
new ways of solving the problem. I like problems which require a good mix of
algorithms and "business logic".

------
gaoshan
I do katas every week and think they are great for both reinforcing good
practice and helping you get over rough patches in your understanding of a
language.

That said there are quite a few katas out there that are either trivial or
merely puzzles to solve. The former are great for beginners but pointless for
anyone else. The latter are fine if you are doing them for the same reasons
you would do a crossword puzzle but they are probably better avoided if your
goals are more practically oriented. The hard part is wading through the chaff
to get to the wheat.

------
pa5tabear
What sources do people like for finding problems?

I've been practicing on TalentBuddy and really like it. It nicely supports
lots of languages, and you can check your solution against others.

www.talentbuddy.co/

------
test001only
Any software like screenflow for windows?

~~~
aharrison
Not necessarily like screenflow, but I have used Open Broadcaster (
[http://obsproject.com/](http://obsproject.com/) ) for this purpose. All it
does is recover various screen buffers to an mp4, but that is more than
sufficient for this purpose in my opinion. Plus it is OSS.

Great for streaming video games to Twitch.tv or its variants, as well.

------
vonseel
I was a bit confused why it had to be under 15 minutes as I didn't know there
was a limit, apparently you can increase it.
[https://support.google.com/youtube/answer/71673?hl=en](https://support.google.com/youtube/answer/71673?hl=en)

~~~
galaktor
It doesn't need to be long. In fact the point is that you don't need to solve
the problem. You just get better at working on it. Short means you can do it
often, and make it a habit.

------
jmolinaso
That's a quite interesting concept, my way to do 'katas' is with
projecteuler.net, now I'm getting some coding speed by reading a book about
patterns or checking the wikipedia for software patterns. If you get to
combine both, then sky is the limit!

~~~
ameoba
PE has always struck me as more focused on math than programming. The easy
problems handle brute force but the hard ones are generally bested by a
mathematical understanding of the problem rather than programming prowess &
algorithmic kung-fu. I've been meaning to check out Rosalind [1] to see if it
opens up the door for more challenging programming or just shifts the problem
domain to biology.

[1] [http://rosalind.info/](http://rosalind.info/)

~~~
tbirdz
If project euler seems too "mathy" try some problems from Top Coder or similar
programming challenges. I find they're pretty fun, and can be a bit of a
puzzle to work out what's the most efficient approach.

~~~
ameoba
I'm not saying that it's "too "mathy"", just that it's commonly trotted out as
a good resource to develop programming skills when, IMHO, it's better suited
to honing mathematical reasoning. All the single page programs in the world
aren't really going to help somebody become better at writing real programs.

------
thinkersilver
Repeating the task over and over again will reinforce good habits ( if you
know the language well) and bad habits, if you are learning the language in
the absence of a reference solution or someone more experienced to review your
work.

~~~
ronaldx
A reference solution, "OK you did it - here's another way", would be super-
useful for learning.

I know that I can complete most any kata, but I don't always know if I'm doing
it the most efficient way under constraints of implementation time, memory or
speed.

------
ratsimihah
We have katas in karate, too.

~~~
daniel-cussen
I think that's the origin of the word. It's a loanword from martial arts.

------
themodelplumber
Trigger alert: Experiments on animals

------
ultimatedelman
Where does an employed programmer find time to do non-work-related katas and
then review them and do them again? wow

~~~
segmondy
The same place all employed people find time to do non-work related
activities. Employed people play video games, watch TV, watch breaking bad, go
to the gym, train for marathons, raise their kids, etc, etc. Your work is not
an excuse for not being able to make time to do other things in your life.

------
Kiro
Where can I do some katas?

~~~
mcphage
If you want Ruby, I've got a repo with some at
[http://github.com/mark/katas](http://github.com/mark/katas)

------
RTesla
Go Mr. Chong!

------
a3voices
How do you measure how good you are at coding? As a follow up question, if you
can't measure it, how can you meaningfully improve?

~~~
saidajigumi
> if you can't measure it, how can you meaningfully improve?

The idea that you _must_ have a quantitative measure to improve something is a
bit overboard. Process analysis can teach you a lot about how you (or others)
work, what the character of that work is, and suggest ways to improve it. For
example, Kim's Screenflow session captures can be viewed as a kind of
Contextual Interview[1] ... with himself! In that light, the primary goal
could be viewed as one of discovery: "how do I work?" versus "how do I improve
metric X in my work?" The initial Kata review may suggest metrics for
improvement, but it's the continual process of open-minded review that will
identify and suggest areas for improvement.

That said, Chong Kim does cite a key metric: time. So on that point, he's
looking to optimize his efficiency with the tools. There's a lot to be said
for just time efficiency; improving this can be a very liberating experience
as a coder. Speaking from experience with contextual interviews done for
others, it's often possible to _significantly_ improve workflow by just
hitting the proverbial low hanging fruit.

That said, time isn't the be-all, end-all IMO. In the Katas, I'll argue for
time as a model which provides structure to that more important inquiry I
cited above: what is his working process and learning process for each new
problem domain? How can those be improved?

[1]
[http://en.wikipedia.org/wiki/Contextual_inquiry](http://en.wikipedia.org/wiki/Contextual_inquiry)

