Chapter 51. Learn to Kata and Kata to Learn
Donald Raab
Every Java developer needs to learn new skills and keep their existing skills sharp. The Java ecosystem is enormous and continues to evolve. With so much to learn, the prospect of keeping up may seem daunting. We can help each other keep up in this rapidly changing space if we work together as a community, sharing knowledge and practice. Taking, creating, and sharing code katas is one of the ways we can do this.
A code kata is a hands-on programming exercise that helps you hone specific skills through practice. Some code katas will provide you structure to validate that a skill has been acquired by getting unit tests to pass. Code katas are a great way for developers to share practice exercises with their future selves and other developers to learn from.
Here’s how to create your first code kata:
-
Select a topic you want to learn.
-
Write a passing unit test that demonstrates some piece of knowledge.
-
Refactor the code repeatedly until you are satisfied with the final solution. Make sure the test passes after each refactoring.
-
Delete the solution in the exercise and leave a failing test.
-
Commit the failing test with supporting code and build artifacts to a version control system (VCS).
-
Open source the code to share with others.
Now I’ll demonstrate how to create a small kata by following the first four steps: