Key Takeaways
- Code Katas, a concept coined by Dave Thomas, is a development learning technique inspired by the martial arts practice of repetitive, systematic training to internalize and adapt movements and techniques. This method is applied to programming by repetitively solving a simple coding problem to perfection, thereby enhancing problem-solving skills and learning new programming languages.
- Procedural memory, a type of long-term memory enhanced by the repetition of complex tasks, plays a key role in Code Katas. However, just repeating a task does not guarantee skill acquisition; changes in behavior as a result of repetition are crucial. Hence, Code Katas should be challenging and engaging to effectively exercise neural pathways and foster new ones.
- While the original Code Katas website is offline, there are other resources available for practicing Code Katas. The author recommends CodeKatas.org and Coders Dojo for practicing and learning from others. Moreover, the best way to learn to develop apps or any other technology related to programming is by doing and learning simultaneously.
Can You Be a Ninja?
After many years working for different companies on different applications, I’ve seen a lot of techniques that claim to help developers improve their programming skills. Unfortunately, only a few really helped me out at all, not only improving myself, but also teaching others.
Some of you may know Dave Thomas, or at least have heard about the “DRY” (Don’t Repeat Yourself) concept or other concepts that he coined. He is a computer programmer and author/editor. One of his most famous books is The Pragmatic Programmer, a book about software engineering published in 1999.
Once the Ruby expansion started, Dave Thomas became one of its biggest evangelists, he wrote a lot about the philosophy and market context behind the origin of Ruby and Rails. It end up leading him to learn a lot about agile techniques and concepts. It is here that he coined the term Code Katas as a development learning technique and started to spread it.
Katas from Martial Arts
The term Kata originally comes from martial arts: it’s the Japanese translation of the word form. Kata is used to describe detailed, choreographed patterns of movement that can be practiced either solo or in pairs.
It can describe other actions in martial arts, as you can see on Wikipedia, like training, high detailed simulated combats, and others.
Kata originally were teaching and training methods by which successful combat techniques were preserved and passed on. Practicing kata allowed a company of persons to engage in a struggle using a systematic approach, rather than as individuals in a disorderly manner.
The main goal of using Katas in martial arts is transmitting proven techniques and practicing them in a repetitive manner. This leads the learner to develop the ability to execute those techniques and movements in a natural, reflex-like manner. In order to achieve this goal, the key isn’t to do this systematically, rather internalizing the movements and techniques, so you can adapt those techniques to different needs.
Practicing
Practicing as a learning method is ubiquitous. We can see it in many areas, not only martial arts:
- Playing a musical instrument
- Improving one’s performance in sports
- Preparing for public speaking
- Improving one’s grammar and spelling
It already has proven itself as a fundamental learning method. Of course, it depends on many factors, but with the right guidance and dedication, you can master a lot of things by practice. This affirmation is the basis of what is called Procedural Memory.
Procedural Memory
Procedural memory is a type of long-term memory, specifically, it is a type of implicit memory that can be used for Procedural Learning. This is achieved by repetition of the same complex task, resulting in an enhancement of the neural systems used to accomplish that task.
Psychologists started to write about Procedural Memory over a century ago. It was first noted in 1804 by Maine de Biran. After much research, it was proven that merely repeating a task alone does not ensure the acquisition of a skill. Behavior must change as a result of the repetition. If the behavior change is observed, then you can claim to have acquired the new skill.
Code Katas
The How
Dave Thomas concluded that it’s possible to use Katas as a learning technique in programming. The approach is really simple: a code kata is a simple coding problem intended to be easily solved, that you solve again and again, repeated to perfection. The idea is to help you to solve the problem in a better way every time you try, while your subconscious learns detailed problem/solution pairs that might help you in other problems. You can even do this by challenging yourself with limitations, such as the use of a language other than the one you use daily.
How Not to Kata
A lot of people think that Code Katas are about solving only the same problem in the same way. This will lead you to learn nothing, but only teach you shortcuts in your IDE. As I said before about procedural memory:
…merely repeating a task alone does not ensure the acquisition of a skill. Behavior must change as a result of the repetition.
As Jonh Sonmez says in this blog post:
just as walking every single day doesn’t make you a master walker, and driving a car every day doesn’t make you a superior driver, solving the same sets of programming problems over and over again won’t make you a master programmer. … Repeating the same thing over and over again without an increasing level of challenge actually results in the mind becoming complacent with the activity.
If you want to use Code Katas, it must be challenging, as walking was when you were just a baby, as driving was when you were just an teenager. Repetition won’t help you if your brain is not engaged.
You must challenge your brain so you can exercise your neural pathways and create new ones. Writing the same code over and over again in your IDE will only make you more comfortable with it.
Where to find it
Unfortunately, the original Code Katas website made by Dave Thomas is offline, but there are plenty of other websites with code katas, challenges, and information. As a Ruby developer I’d recommend:
- CodeKatas.org – Codekatas.org is intended to be the go-to place when you’re looking for Code Katas, whether you want to watch someone else perform or start practicing yourself.
- Coders Dojo – A great list of katas in many languages. It also has a web client in Ruby to perform katas online, along with many examples in their catalog.
Learning
Many people ask me how they can learn to develop iOS apps, Android apps, single page apps, or any other technology related to programming. The answer is simple: make those apps.
“But, what post or book should I read about building those apps?” Forget about books for now: just start putting your idea on paper and begin the development process. Learn and do at the same time.
Raising the Bar
The reality is, there is no silver bullet. But there are a lot of techniques out there, and if you really want to improve your programming skills, Code Katas is one of those techniques. You don’t have to fall in love with it, just give it a chance.
The truth is, if you want a different outcome, you have to change something.
Frequently Asked Questions (FAQs) about Code Kata
What is the purpose of Code Kata?
Code Kata is a method of practicing coding skills in a focused and deliberate way. It’s similar to how martial artists use kata to perfect their movements. The main purpose of Code Kata is to help developers improve their skills in programming through repeated practice. It’s not about solving a problem, but rather about practicing the process of solving a problem. This helps in enhancing problem-solving skills, learning new programming languages, and understanding design principles.
How does Code Kata differ from regular coding practice?
Regular coding practice often involves working on real projects or solving problems as they come. Code Kata, on the other hand, is a more structured form of practice. It involves repeating the same problem over and over again, refining and improving the solution each time. This repetition helps to engrain certain patterns and techniques into the developer’s mind, making them second nature.
How often should I practice Code Kata?
The frequency of practicing Code Kata depends on your personal goals and schedule. However, it’s generally recommended to practice regularly, such as daily or weekly, to get the most benefit. Regular practice helps to reinforce the skills and techniques learned, and can lead to significant improvements over time.
Can Code Kata help me learn a new programming language?
Absolutely! Code Kata is an excellent way to learn a new programming language. By repeatedly solving the same problem, you can focus on the syntax and idioms of the new language without getting distracted by the problem-solving aspect. This can help you become proficient in the new language more quickly.
Are there any specific problems I should use for Code Kata?
There are no specific problems that you should use for Code Kata. The idea is to choose a problem that is complex enough to be interesting, but not so complex that it becomes overwhelming. The problem should also be suitable for the language or technique you are trying to learn. There are many resources available online where you can find suitable problems for Code Kata.
Can I use Code Kata to prepare for coding interviews?
Yes, Code Kata can be a very effective way to prepare for coding interviews. By practicing problem-solving in a structured and deliberate way, you can improve your ability to solve problems quickly and accurately, which is a key skill in coding interviews.
How can I track my progress in Code Kata?
One way to track your progress in Code Kata is to keep a record of each session. This could include the problem you worked on, the solution you came up with, and any insights or learnings from the session. Over time, you should be able to see improvements in your solutions and problem-solving skills.
Can Code Kata be used in a group setting?
Yes, Code Kata can be very effective in a group setting. Working in a group allows for collaboration and discussion, which can lead to deeper understanding and learning. It can also make the practice more enjoyable and motivating.
What are some common mistakes to avoid in Code Kata?
One common mistake in Code Kata is focusing too much on the solution rather than the process. Remember, the goal of Code Kata is to practice the process of problem-solving, not just to find a solution. Another common mistake is not practicing regularly. Regular practice is key to getting the most benefit from Code Kata.
Can beginners benefit from Code Kata?
Yes, beginners can definitely benefit from Code Kata. In fact, it can be a great way for beginners to get started with coding. By focusing on the process of problem-solving, beginners can develop good habits and techniques from the start, which can help them become better coders in the long run.
I’m a leader engineer and manager, currently living in São Paulo, Brazil. I'm an enthusiast technologist that love open source, a blog author in RubySource and my own blog, and also a speaker of some international and national conferences like TakeOff Conf in France, Ruby Italian Day in Italy, GURU, SevenMasters and others.