Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently found out about the idea of code katas at Dave Thomas's blog and was really interested in it.

I'd like to hear the opinions of people who have experience with code katas; is it assumed that I should practice one kata until I find a solution to the problem, or there is another explanation?


migration rejected from Jul 13 '15 at 18:27

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as primarily opinion-based by durron597, MichaelT, enderland, Snowman, Dan Pichelman Jul 13 '15 at 18:27

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

Are you asking whether you should move on to the next kata once you find a solution (any solution), or you should stick with it to improve your first solution and/or experiment with alternative approaches until you are fully satisfied with the result? – Péter Török Oct 20 '11 at 14:21
No, As I understand correctly the historical destination of cata (in Japan, I mean) was an improvement of skills of martial arts masters and they practiced one kind of cata during all of their life. Can this approach also be reflected to programmer's life? – teoREtik Oct 21 '11 at 7:12
AFAIK that is more of an extreme case, most practicioners do practice and learn many katas over the course of their career. – Péter Török Oct 21 '11 at 7:45
Until you are enlightened, Grasshopper. – Dan Ray Feb 7 '12 at 21:59
up vote 18 down vote accepted

This may depend on what you want to learn by it. Code Katas are not quizzes or puzzles. You can (and should) not only try to 'solve' it, but find a very good solution, following best practices of the programming language you are using. Maybe you solve it as best as you can for now and a few months later you learn something new and come back to it and optimize your code. Another way to use them is when you learn a new programming language. Having a small Kata like project with a problem space that you understand very good, thanks to earlier solutions in other languages, you can use this same project to test and enhance your learning of the new environment.

As examples you can start implementing a Sudoku solver in C++. When later you learn Ruby, you can take your knowledge and try to implement the same program, but now use all the features of Ruby (while learning them) and implement it, this time concentrating on the new language. (and maybe avoiding those boring tutorial problems)

Some time later you may by chance read an article or blog about Donald Knuth's 'Dancing Links' algorithm and find, that you can use it to write a far better program.

This way a single Kata may follow you over a long time period.

Since this answer has a few likes over a longer time period, I want to add one more detail (for now). There are other things I think can be regarded as code katas even if they are not about writing code. Setting up a development machine, for example with Ruby on Rails, some important libraries and gems, some database drivers and similar tools. Having done this more than once and seen different errors will make you far more comfortable with your everyday tool chain. Especially if you setup similar tools on slightly different systems like Linux and Mac OS X.

Incredible answer. Thank you very much, you helped me to recognize – teoREtik Oct 21 '11 at 7:17

Solving the problem isn't necessarily the point of a kata. The process of solving the problem is what matters most. If the task you're attempting is so hard that you can't eventually find a solution, then try a different kata.

With practice on a single kata, you're time will improve, and you'll gradually make fewer and fewer mistakes and the technique you're using becomes ingrained.

You can also benefit from solving the same task in multiple ways. Use different techniques, different languages, different frameworks, etc. The point is to practice a given series of steps until they feel natural.

Thank you so much, your answer is very useful too. – teoREtik Oct 21 '11 at 7:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.