Forms and Functions: What Martial Arts Taught Me About Programming, Part One

Jet Li in a fighting stance
When I was in my 20s, I was often learning some type of martial art, mostly Taekwondo. My initial motivation for doing so wasn’t the deepest (“Whoa, Jet Li is cool! I want to be able to do that!”), but what I got out of the experience was far more than I had initially hoped. I became more disciplined, more patient, and my ability to focus was substantially increased. What’s even better is that the mental benefits persisted for a long time after I stopped actively practicing. Today, I’m going to talk about how learning martial arts forms informed my approach to algorithms and problem-solving.

Martial arts are a visual practice, in that they’re extremely dependent on the master /sifu/sensei demonstrating to students how techniques work. One area where this is particularly vital are within forms (aka kata in Karate, poomsae in Taekwondo, etc), which are a formal set of moves performed in sequence, with or without a weapon. They are an excellent endurance exercise and can be looked to for a source of possible move combinations, but their primary purpose is to build coordination and body control. So what do forms and programmatic problem-solving have in common?

Students in a karate class

Solving algorithms or learning a new programming technique (setting up a basic web server in Express, to name an example) are much like learning forms in that you need to approach them step by step, one sub-problem at a time. Everything you do is based in skill, whether it be segueing from a low side-kick with your left leg to a high punch with your hand or returning a copy of an array in JavaScript without modifying the original array. This takes deliberate practice on your part. This is not a surprising take, and most folks know this.

However, many newer programmers overlook the value of seeking out masters in certain programming specialties and learning from how they approach the work. This is not only valuable in terms of learning new or improved techniques, but also in seeing what mastery in that field specifically looks like, so they can adjust expectations accordingly.  Also? Sometimes you *can’t* be reasonably expected to independently come up with the answer to a problem because you haven’t encountered similar problems. The example I give in the above paragraph about returning a copy of an array wouldn’t be at all difficult to someone familiar with functional programming techniques, but much more difficult to someone who isn’t. There’s nothing wrong with looking up answers provided you take the opportunity to break down the solution and learn from it, so you can add it to your toolbox of solutions for the future.

Kung Fu teacher with student

In a profession as bloated with learning possibilities as web development, I can’t over-stress the importance of keeping your personal goals and expectations down to earth this way. I watched Google Developer Expert Stephen Fluin give an Angular 6 demonstration in which he impressively hand-coded Angular boilerplate in notoriously difficult text-editor Vim, but still made the same temporary mistakes and syntax errors you or I make every day when programming. A good source of these demonstrations are often conference talks or long-form demos on YouTube, like this Twitch stream by Angular Style Guide author John Papa.

One last thing I’ll leave you with: as anybody who’s studied either martial arts or programming knows, it is hard work, and there are no shortcuts. But approaching them with a determined, positive attitude and a willingness to learn will make the path easier. See you next week!


One thought on “Forms and Functions: What Martial Arts Taught Me About Programming, Part One

  1. Pingback: Like A Song: What Music Taught Me About Programming, Part One – Michael Caveney

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s