Coding is not Kata

I promised on Twitter to write a blog post explaining why “kata” was the wrong word for the “coding kata” problems presented at CodeMash this past week in Ohio.

First and foremost, I absolutely loved the idea of these coding problems. The problems were very similar to those found in computer science classes (for example, find all the prime numbers between 1 and 100), but the goal was to explore new languages or coding techniques (like TDD). For me, getting to pair programming with a coworker using TDD/xUnit to solve a few coding problems was definitely a highlight of the conference.

However, as a martial artist, to me “kata” is the wrong terminology to use in this context. The correct terminology is either “coding kihons” or probably more accurately “coding kumite”.

What is Kata

There are 3 parts to the study of karate:

  • kihon (basics) – front stance, back stance, lunge punch, reverse punch, snap kick, etc.
  • kata (forms) – planned series of movements where a karateka (one who practices karate) seems to fight an invisible opponent
  • kumite (sparring) – fighting against a fellow karate student

You cannot study karate without all 3 components.

In Shotokan karate, the style I practice, there are 26 katas. The movements for each kata never changes. In other words, there is only one way to do the kata, meaning that your stances, kicks, and punches must be exact, and the timing must be correct and sincere, as if you were attaching an invisible opponent. In a karate competition, those who compete in kata are measured based upon who can perform the kata closest to perfection.

Over the course of one’s study of karate, you perform the kata over, and over, and over, and over, just like the 10,000 hours theory in Outliers. (Personally, I am not comfortable doing a kata until I’ve done it at least 100 times.) Not only does the body eventually optimize physically, but something mentally happens. You go into an “auto-pilot” mode. For example, have you ever driven to your house one day, but don’t consciously remember the specifics of the drive, because you’ve done it so many times before? This is what a karateka is trying to achieve in kata (and in kumite, and in all walks of life). The term for entering this “auto-pilot” mode is called mushin, but I digress…

The basic idea of kata is you’re trying to perfect a given series of moves via repetition. There is no deviation. Or from a Zen perspective, you’re trying to reach that state of mushin where you are in total focus and concentration, where the mind and body have become one (which is also illustrated in “kime” where you unlock your ki / chi in a split second, but I digress yet again). My first karate Sensei told me that in kata you imagine that you are fighting the dark side of yourself, all the things you dislike about your character. You visualize these negative aspects and you fight them. Thus, the more you do kata, the more your character improves.

The point I’m trying to make is that there’s a much larger aspect to kata than going through the movements.

What a “Coding Kata” would really look like

Below are a couple of examples of what I think a coding kata could look like:

Kata #1: The Implementation of Hello World in C#

public class Hello1
{
   public static void Main()
   {
      System.Console.WriteLine("Hello World!");
   }
}
Kata #2: The Implementation of Bubble Sort in C# (via C# online)

private int[] a = new int[100];

private int x;

public void SortArray()

{

  int i;

  int j;

  int temp;

  for( i = (x – 1); i >= 0; i– )

  {

    for( j = 1; j <= i; j++ )

    {

      if( a[j-1] > a[j] )

      {

        temp = a[j-1];

        a[j-1] = a[j];

        a[j] = temp;

      }

    }

  }

}

And you would practice these katas as many times as possible, until you can code it wearing a blindfold or hold a conversation while coding this method.

In my opinion, coding katas are really just sample code or an algorithm for doing something. Just like a real kata, you know exactly what it is you are supposed to do. You’re just learning to repeat it over and over again, so it becomes second nature.

But, I’m not sure whether repeating these lines of code over and over again would make you a better coder. It would definitely help initially, but I’m not sure the benefits after that point. Maybe a true “coding kata” is mastered much faster than an actual karate kata.

Why Coding Kumite is a better term

Kihon is learning the specific techniques, like punches, kicks, stances, etc. In kihon, you practice these techniques in isolation, and you repeat each individually over and over and over again. To me, coding kihon would be the equivalent of learning the syntax of a language, learning lamda expressions, or learning generics. Kihon is not about solving a problem, but rather learning what tools you have available to solve a problem. Only after one learns kihon, can a karate student learn kata and kumite.

Looking at these coding problems, you could make the argument that your opponent is the problem to solve. And you’re using all your kihon practices to solve the problem, just like you would do in actual sparring (or in kumite.)

Conclusion

Having said all of this, my “Coding Kumite” analogy still falls short. I think only in debugging, where you are trying to find and fix bugs, is actual “coding kumite”. But, writing code to solve a problem still feels much closer to kumite to me than kata or kihon.

For a different perspective, you can check out Steve Andrew’s blog post called Shotokan Development. He watched my Nidan (2nd degree) black belt exam back in November, and wrote a blog post from the perspective of a software engineer on how to apply Shotokan teaching methods to software engineering.

Lastly, I’ve never experienced mushin in coding like i have in karate. Maybe someone out there has and can respond with a counterpoint to this. I’m really curious what others think, and I definitely would love to discuss these concepts further. I really think we could put together a teaching framework based on karate concepts, if anyone is interested in helping me out.

Maybe the next open spaces unconference I can propose a topic on karate terms in coding, but that’s only if Doctor Who is no longer making me need a support group. =D

Training for Nidan (2nd degree black belt)

I’ve been wanting to write this post for a while. On Nov 6, I’ll test for my second-degree black belt in Shotokan Karate. Karate is a significant part of my life, so this belt exam means the world to me (especially after my leg injury 2 years ago). I’ve been doing Shotokan since I was 15, with the exception of my college years (no karate dojo in Northern Mississippi at the time.) Not having Karate would be like not having jeans to wear to work at Microsoft. I would have no idea how to live.

What does 2nd degree mean?

First of all, there are 10 degrees of black belt in most styles. In Shotokan, 10th is awarded posthumously. I have no idea how 10th degree is awarded.

I always say that a 1st degree black belt means that you know how exactly bad you are. Or another way I heard it phrased is that at 1st degree your training finally begins.

I think second degree means you’re showing signs of potential that you could maybe one day perfect the techniques.

Do you have to win your fights to pass the exam?

No, it doesn’t work that way. Maybe some styles do, but Shotokan is focused on three areas:

  1. Kihon (basics) – the basic moves consisting of stances (front stance, side stance, …), punches (lunge punch, reverse punch, …) , kicks (front snap kick, round house kick, …) and blocks (rising block, downward block, …)
  2. Kata (forms) – 26 choreographed series of movements that represent a fight against numerous opponents. (As it was explained to me when I was 15 years old, you are visualizing numerous clones of yourself attacking you, where these clones represent the worst aspects of your character that you wish to eliminate. Therefore, the more you do kata, the more your character should improve.) At 1st degree black belt you are required to know the first 12 series of movements (or forms, or katas). I only know about 19 of them currently.
  3. Kumite (sparring/fighting) – exactly what it sounds like. But it isn’t about trying to winning. It’s about trying not to lose. In competition, yes, it’s all about the winner. But in a belt exam, it is about how well you understand the sparring concepts and put them into practice. For example, if someone literally showed fear when a punch was thrown at them, they are probably not going to pass. Whereas if someone could effectively block the first punch, but wasn’t fast enough to block a follow-up punch, then they are showing the right concepts and would probably pass.

The exam (which takes about an hour) covers all 3 aspects. For kihon, you have to demonstrate each of the 20 or so basic moves roughly 6 times. That part takes about 30 minutes. Then you move into Kata, where you demonstrate each of the katas for your level once. For Nidan there are 5. Now about 45 minutes have gone by, and now it is time for Kumite. Why fighting at the end? It’s because that’s where you are most likely to get hurt (although I’ve seen people get injured during kata), so it is always at the end, in both belt exams and in competition. You usually fight 2-3 people, just enough to see your sparring techniques. Again, it isn’t about winning or losing, but whether you can hold your own and show proper understanding of free sparring (competition fighting).

If you’re not fighting someone, how do you pass?

It’s kinda like “Best in Show” at a dog show. You are measured against the standard or the perfection of the technique. Again, since 1st black belt means you are just staring your training towards this perfection, there’s some sort of measure of how far off from perfection you are allowed to be at each degree of black belt.

For example, here’s a link to some videos of a 7th degree black belt (a Sensei) demo’ing each of the 3 areas of Shotokan. There is no way I will ever achieve this level of perfection in my lifetime. But, I’m going to try for my entire life to come as close as possible. And however close I get will determine my rank. 

He and his father (who is a 9th degree black belt) will administer my black belt exam in this upcoming November.

Training schedule

How do you train for a 1-hour anaerobic exam such as this? You start training very, very early, and you train as consistently as possible, only gradually adding more workouts or increasing intensity. As my physical therapist told me, “you are allowed to knock on the door of the house of pain, but you are not allowed to go inside.”

Recall I broke my leg at this time 2 years ago. It took a full year going to physical therapy just to walk into the dojo for the first time again. (Moral of the story: never let your quad muscle atrophy.) You could say I started training for this exam that day, or you could say I started training in this past Fall when I learned the first of the Nidan katas. Your pick.

My current training schedule per week (as of this blog posting):

  • 1 workout with personal trainer (core strength; overall training advice)
  • 3 karate classes per week
  • 1 karate workout 1-1 with my sensei
  • 1 karate workout by myself
  • 2-3 Brikham hot yoga classes (flexibility; recovery from leg injury; reminds me of weather back home)
  • 1 spinning class (stamina; recovery from leg injury)
  • 1-2 rock climbing (cross-training to give me another challenge so i don’t burn out on karate)
  • 30-40 knees to chest jumps daily
  • 1 rest day (no working out whatsoever)

It’s taken me about 6 months to build up to this workout intensity. Last year at this time, i couldn’t even do a karate class a year ago at this time because the pain in my knee was too great. Or at hot yoga, I couldn’t even put any pressure on my knee just kneeling down. (Seriously, never let your quad atrophy). I would need 6 bags of ice (3 for leg, 3 for shoulders/neck) after one easy karate class just this past last Sept/Oct.

What I do to prevent injury

Here are the things I do to make sure I’m only knocking on the door to the house of pain:

  • Keep an exercise journal. I write down what I did and how I felt each day. After doing this for several weeks, you’ll start to see patterns in your progress or injuries. For example, if I do 2 very hard workouts on consecutive days, there’s a very high chance I’m going to be injured if I do a very hard workout on the third day.
  • Make a weekly plan that balances my low-impact workouts with my high-impact workouts. I know that hot yoga classes are low-impact versus karate classes that are high-impact. 
  • Keep a food journal. I’m not so much into counting calories as i’m trying to make sure I’m eating consistently. Also i found that eating as big of a breakfast as possible has really helped me improve my energy levels, especially for evening workouts.
  • When in doubt, ask someone. I hired my personal training last year to help me recover from my leg injury. Now, his job is to build up my core as much as possible, and helping me plan this crazy workout schedule of mine.
  • Listen to my body. Probably the most obvious, but the most overlooked, especially by younger versions of myself. If i’m just not feeling it, i back off on that technique. If i’m just not feeling it the entire day, I consider the day a rest day and recalibrate my workout schedule. It’s all about seeing how long i can go without getting injured, or as I say “My goal is to never see the physical therapist again.”
  • Get a full night’s sleep. If I get < 6 hours, I can still work out that day, but the next day must be either a rest day or a light day, and recalibrate my workout schedule. Again this is where a workout journal comes in handy to see how your body reacts to changes in your routine.

It’s all about consistently and only gradually adding more workouts or increasing intensity. When I get back from a week at TechEd, i’m not going to be able to do even half of the exercises I’ve listed above. Knowing this I’m going to plan a workout at 1/4 the intensity, meaning just 2 karate classes and maybe a hot yoga class and/or rock climbing class. And of course, I’ll have to tell my trainer not to push me that week.

It isn’t about how much can I work out, but whether I can live to work out another day.

Anyways, I hope this post was interesting. And now back to working on my CodePlex TechEd talk.

Walking through the dojo door is the hardest part

That’s why our Sensei and many other high-ranking black belts said to me last night.  I torn my shoulder in Jan 07, then broke my leg in May 07, spending the entire summer on crutches.  The irony is that we won a world karate tournament back in Oct 2006, but there’s no way you would have known if you saw me last summer driving around conferences in a scootersighargh.  (yes, each link is its own adventure)

For those of you who just tuned into my blog via Tip of the Day, I’ve been practicing shotokan karate since i was 14, including both JKA and FSKA branches.  And as a blogger, i started a karate feed to talk about karate, why i do it (for the art, not the martial), and what i get out of it.

I have to stand during the opening and closing ceremony, something i’ve never had to do before, even.  this is when everyone kneels, does a brief meditation, and listens to the instructor for goals for the class.  But since my leg is only at 60-70%, i still have a long way to go, but just walking through that door was the hardest part.

The most important thing i learned from last year is a saying by the Shotokan style founder (with my personal additions to it) that karate (or any exercise for that matter) is like a pot of warm water.  You don’t want to boil the water, because at some point nothing will be left and you’ll end up with a broken leg and torn shoulder, but you don’t want the water to get cold either.  so you have to train using moderation, something i swear i’ll learn this time.

And now back to the day job…

My Karate Kata Video finally Posted

Here’s the link to my individual kata video.  Note that this isn’t the event we had been training the 9 months for.  That’s another video, which i hope to post, well, um, yeah, as soon as i can, considering this only took me 2 months to post =)

http://www.youtube.com/watch?v=FD_nhXbktyc

Nothing like feeling the tape under your feet during the yame (final move to resting postion).

Karate Tournament Results

View Photos – I hope to have the video of our team kata and my individual kata posted this weekend.

We took 1st place in the Women’s Team Kata.  It was really close, as the second place team did a fantastic job of Jion perfectly synch’ed.  We did Gojushiho Sho, which is a more difficult kata, so it gave us a slight edge.  i haven’t seen the video yet.  i can’t wait to see the video.

I took 2nd place in the women’s black belt (age 28-35 category) individual kata.  I did my kata more "martial" and the first place kata winner did hers more "art", but she had a lower stance and was more technically accurate than i was, and she trains at the main FSKA dojo (with Shihan), so I felt honored to tell her congratulations.

The best moment for me the entire trip was doing the Yame (finishing move back to the ready position), feeling the tape under my feet (you are supposed to start and end on the tape), and hearing everyone from my dojo start cheering very loudly for me.  A close second best moment was having Shihan (the title for the top ranking instructor in the FSKA style of karate) take a picture of me during my individual kata (as my karate team told me afterwards).  Now that is worth any gold medal.  =)

Seriously though, it was an honor to be able to compete.  It had been 12 years since i had competed in a tournament.  And to train for 9 months straight, to be able to make a commitment to your team, to be able to follow thourgh injury-free, and to do compete among people from all over the world is why i love karate.

I cannot wait to see the video.

FSKA VIII World Karate Tournament this weekend!

I’m competing in the FSKA World Karate Tournament in Las Vegas this weekend in Individual Kata and Team Kata.  We (the team) have been training every Saturday morning at 7am since March 25th.  I am so excited that this date has finally come.  Team kata is where three people do the kata at the exact same time with the exact same intensity, landing right back at the exact same spot (without any counting).  The kata we’re doing takes almost 2 minutes to do, so it is a *lot* of work to keep focus for that long.

I’m doing the same kata for my individual.  i love doing kata competitions.  i love the feeling of focusing so hard on just the kata that you tune everything else out.  And of course the adrenaline rush lasts for an hour (from just 2 minutes of work).  Probably why i’m a adrenaline junkie.  =)

We have several camcorders going with us, so i hope to have the video posted when we get back.  Very cool stuff. 

Wish us luck!

My First Karate Practice as a Black Belt

Found out over the weekend that we had passed.  Everyone going for shodan (1st degree black belt) had passed.  Sweet.

Technically, I’m not a black belt until the ceremony in mid-Jan when we have our belts and certificates handed to us.  However, last night when I got to practice, several of the guys made it a big deal to bow to me (as it is customary to bow to any black belts in the class when you’re a lower rank).  It was pretty cool.  Now, I get to look forward to perfecting what I already know and to help the lower ranks (like those guys from last night who are going for black next year) get ready for their Shodan exam.  And yes, we’re going to start training them early, very, very early for this exam.

How the black belt exam went

I won’t know the results of the exam until our head teacher is ready to give them to us.  I’m guessing they are waiting for our checks to clear before we can go to the bank and pay the 20 buck to stop the check.  =)

Wow, I’ve received several mails from blog readers asking me how it went.  Sorry it took some time to get around to posting.  I’ve needed time to heal.  =)

To sum it all up:  interactive seminar-style exams are not cool.  not cool at all.

For whatever reason, those grading the exam decided it would be a seminar-style, where a 6th degree black belt would interact with us on the floor while the 9th degree black belt graded us.  In essence, we were told to do a technique, let’s say a lunge punch, 6 times forward w/ right hand, turn around and do it 6 times again with the left hand.  After we finished a technique, the sensei (the 6th degree black belt) would explain where we were making mistakes and ask us to do it again.  Many times I felt we were taking the test twice. 

The best I can describe it was like taking a Math exam with the teacher looking over your shoulder telling you, “you did it wrong, try again.”  Normally, you wouldn’t think this is a bad idea, but let’s say you only have 20 minutes to take the entire exam, and it’s going to be tight to finish in those 20 minutes.  So what do you do?  Do you complete the entire test, but knowingly get stuff wrong?  Or do you try your best to get stuff right, but not be able to complete the end of the test? 

It was the same situation here.  First, it is a shock to one’s system to be told “you’re doing it wrong” right at the beginning of any exam.  Second, you’re wasting so much energy repeating the moves and trying to get it right.  The question was, “do I ignore the 6th degree black belt’s recommendations and keep pacing myself?”  Oh yeah right, like that’s going to happen. 

We used up all of our energy (we only have so much) and by the time we got to the last 7 or 8 techniques, the kids were breathing hard and the adults (all 2 of us) were gasping for air.  We were barely moving.  It was a sad site.  One person started crying, another started dry-heaving, and I was wondering what the etiquette was to throw-up (thankfully I was able to keep in back).

The absolute worst part of the test was having the row of spectators sitting on the back wall.  Almost directly in front of me was my Tuesday night teacher.  I kept thinking with every punch and kick in his direction, “I am so sorry.”  You see, a student’s performance is a reflection of the quality of the instruction.  Although I feel we didn’t get enough personalized attention from our head teachers going into the exam, I didn’t want my performance to be a reflection upon the teacher who had helped me the most over the past year.  Gosh, I’m such a girl.

When we were finally finished with part 1 (basics), we got to sit down.  The oxygen flowed back into my head for the first time.  It felt exactly as waking up from sleeping or fainting.  I wondered to myself, “Where am i?  Am I taking my black belt exam?  Was I involved in a train wreck?  Oh well, I’ll just make it up in the kata.”  Our head teacher was trying to signal to me to go get some water, but I wouldn’t look at him.  The performance was so embarrassing that I didn’t want to make eye contact with anyone.  I was too scared for any feedback.  =)  And no, I didn’t get water.
Kata was much, much better.  We had to do all 6 kata (forms) at full speed with no breaks, which was okay with me.  Kata is what I’m best at.  And eventually you learn of the rhythm in each kata that allows you to catch your breath.  Free-sparring (fighting) was also pretty good.

After the exam, none of the teachers spoke to us, as far as I know.  That was the most difficult part, knowing your performance was poor (okay, my friends watching me that night and the other students have told me that we did great, but knowing you could have done much better makes it poor in my book) and no one is speaking to you afterwards.  My Tuesday night teacher had to leave early, so we sync’ed up the next day.  Yes, we had to go back the next day for the real seminar. Still none of the teachers spoke to us, or at least to me.

Usually after sporting competitions, especially karate ones and being a soccer goalie during shootouts, I find myself wishing I could go back and redo it, do it better or pick right instead of left.  For this exam, however, I absolutely do not want to go through that again.  Ever.

Am I upset?  Absolutely not.  I finally got to test for black belt.  Finally.  And as I said earlier, a student’s performance is a reflection upon the instruction.  Also, what can you do when your exam is turned into an interactive seminar?  Actually, I’ve been laughing mostly at everything – it was so over-the-top difficult.  The other adult taking the exam and I went out for beer afterwards.  It was the best beer of my life.  It was also the best debriefing of my life.  =)

If anything is to come of this, next year’s class will be very well prepared.   My advice – be able to do every single technique on the exam sheet 6 times forward, 6 times back other hand at full speed without any breaks.  When you can do that on your own, you’re ready.

View original comments