In recent weeks, Clean Coders silently published a few Code Katas on our YouTube Channel.
I love Code Katas. They're a wonderful learning tool for new coders and veterans alike. It's a technique I consistently use when mentoring apprentices. Any of us coders who want to improve our skills should practice Coding Katas to benefit from these:
Like watching Bob Ross paint or Jimmy Hendrix play the guitar, you know a master craftsman by the way they move. They know their tools intimately. They achieve their desired effect with minimal effort. Masters make it looks easy. This is also the case with software. Master coders make coding looks easy. They know their language, their editor, all the shortcuts, idioms, etc. Code flows out of their fingers and onto the screen like a magic fountain.
There's only one way to achieve that level of skill: repetitive practice. It's the kind of rote memory or muscle memory that you build from practicing katas over and over.
We all have disciplines, or at least we should. They're the rules we follow that allow us to consistently produce high quality code. Clean Coders practices Test Driven Development, among other disciplines. Katas are a terrific opportunity to explore new disciplines and fortify the disciplines you've adopted.
switch statements a few times.
When you take on a new kata, this is what you should expect from your sessions:
Each repetition of the kata takes you to new depths of understanding the problem, the language, the algorithm, etc... Rarely do you get these learning opportunity while working on production code. And going to these depths helps you see subtle patterns and structures in the code that you'll remember and reuse in your career.
If you practice katas alone, great! You should also perform your katas for your peers. In 2013 I wrote a blog about Performing Code Katas.
In martial arts we perform katas (forms) during class, during tests, and for competition. Why? To demonstrate skill and to get peer evaluation.
"You want me to write code, live, in front of my coworkers?" Yes! Absolutely!
That idea probably makes a lot of coders uncomfortable. But I tell you, it'll make you better. Your peers will tell you what they like about your coding and how you can improve. And as a spectator, please be kind and constructive to kata performers.
One of my favorite kata performances is FizzBuzz by Sandro Padin, previously mentioned above. He was my apprentice at the time and I could not have been a prouder mentor. It still brings a tear to my eye when I watch it. It is a beautiful kata. A work of art!
Rather than tell you why I think it's so great, I urge you to watch it from start to finish. Maybe you'll agree with me, maybe not. It's art!
The point is, there is beauty in our craft. Software can be beautiful. Code Katas allow us to express ourselves and strive to write beautiful code.