Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Oct 20 '11 at 14:07

This question came from our site for professional and enthusiast programmers.

    
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
2  
Until you are enlightened, Grasshopper. –  Dan Ray Feb 7 '12 at 21:59

2 Answers 2

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.

share|improve this answer
    
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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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