The Ultimate Code Kata

As I was paging through Steve Yegge's voluminous body of work recently, I was struck by a 2005 entry on practicing programming:

This is a companion discussion topic for the original blog entry at:

I am reminded of the book “The End of Ignorance” by John Mighton, a math teacher. He noticed a similar phenomenon of students who have had hundreds of hours of math instruction, yet are unable to solve the simplest questions.

His solution, a method he calls JUMP, is actually the same thing as “effortful study”. He creates a long detailed list of problems, starting with trivially easy ones, that get slowly more difficult yet incorporate previous information.

I am not trying to advertise the book or method, but I wonder if there is a similar sequence of problems for computer programmers?

Why all the focus on the resume and the interview (in the first list)?

As I read it, Steve is advocating not the interviews themselves, but learning how to effectively communicate what you’ve done to other programmers or perhaps even people who aren’t programmers at all, in person.

Sort of like the elevator test, really:

A very useful kata, indeed…

I equate kata to practicing the fundamentals, not as in your examples of pushing your limits by trying new and challenging tasks, I think what you’re writing about is a different kind of growth, and definitely important, I just think there’s a different word than kata.

A kata is shooting a thousand free throws or Mikan drills ( per day, or performing the exact same sword stroke, or kung fu moves as you pictured, day in and day out for YEARS. Or even yoga poses with the intent to get that one move PERFECT. And certainly within those 1000 free throws there’s plenty of room for subtle nuance and experimentation to improve form. But the basic motion and goal is the same.

In programming I’d argue that translates to doing things like (and in your own time on the path to self improvement) implementing a linked list for the umpteenth time, or a quick sort algorithm from primative types and structures (no base class library ArrayList.Sort cheats). I don’t think 99% of coders do this, except perhaps when trying to learn a new language from scratch. I DO think that a list of “programmer free throw” exercises like these would make an excellent section on

I think what you’re describing is more like cross training, a very very important aspect to overall agility and adaptability, but quite different than a kata.

There is a huge difference between being an expert programmer and being a professional program, though they are not necessarily mutually exclusive (they are also not necessarily complimentary).

Professional programmers know about process and teamwork. They don’t just write good code and solve problems correctly, but they can work collaboratively with other programmers, follow coding guidelines, recognize when solutions are too clever, don’t let their egos get in the way, and can do it right for the environment they are working in.

Expert programmers can write code to difficult problems but it says absolutely nothing about whether they can work in a professional environment.

Some of the ideas posted above contribute to either quality. Ideally one would strive for both. It is important for folks to realize there is a difference though, and that professional programming is only partially about writing code.

I would ad that the the best professional programmers spend time testing. The use products and find out what is wrong with them, and can get a mindset that thinks past “how can I make this work” and also thinks “How can I make this not work”. Professionally I will take the output from someone capable of that over someone who knows some clever trick to solve a problem any day, because in terms of the end result my product will be much better from the former than the latter.

The point of a kata isn’t that you’ve done it 500 times, but rather that your entire focus was on every part of it, every time you did it. It’s the same with programming, only if you’re self-aware of the process will you be able to evolve as a programmer – rather than just doing the same kind of problems faster. E.g. if you need to use some code you’ve seen somewhere else in your code base… do you copy’n paste it to get your current task finished as soon as possible? …or do you go through the effort of pulling it out into a module, making it generic, implementing missing parts of the interface – and then change the original code to use the new module, as well as using it for you current task. I know what kind of programmer I want to work with, and that’s the standard I’m setting for myself.

If you’re a mindful programmer at work, then perhaps it isn’t so necessary to program when you get home. In fact, if you’re not enjoying it, you should probably take a break and do something completely different. As long as it is something, active physically or mentally, inspiration will sooner or later grab you by the balls and squeeze until you can’t help but try out your new idea.

ps: if some of you are looking for problems to solve, go to comp.lang.your-language-of-choice and try answering the questions that come up. It will give you problem-solving practice, writing-about-programs practice, and you might actually help someone :slight_smile:

pps: I practice what I preach:

While I’m not for copying code from the internet and pasting it into my software, why should a “good programmer” really understand how everything works underneath the code?

Because it’s the difference between being a technician who merely applies other people’s solutions to a problem and an engineer who can do that or build an entirely new solution from scratch. There’s nothing wrong with either career path but it’s the latter who are building the search engines, operating systems, etc. that we all use.


If you’re suggesting all of the software you use was written by someone who could build an operating system from scratch then I think you might be going a little overboard.

Consider something like the online banking service that you access via the web. It seems more likely to me that the person or team that built that used technologies like ASP or PHP to construct their application. They most likely had more people that knew the difference between banking terms and regulations as opposed to how the routines of the System.IO.File class performed their magic.

They may have had several people who knew C or something like that, but do you think they were focused on writing a new way to write files to the hard drive, or instead bringing as many of their services to a web interface.

Does that mean they aren’t “good programmers” because they didn’t write their own web server system to handle incoming requests, but instead relied on existing technologies? I’m not saying I know, I’m just trying to differenciate.

It seems to me software development is just like the construction business. You’ve got people who build the houses and you’ve got people that build the tools for people to build with. Does that mean because they don’t know how the power drills work on the inside they don’t know how to build a house? Do they need to know how to actually build their own concrete mixers before they are a real “builder”?

I dunno… just rambling on, but it just seems to me that people embrace this all or nothing mentality when it comes to software development. Either you know all your 1s and 0s or you don’t know anything…

Although I mostly agree with the post and with things such as practice vs improve, and study vs experience (that last not so much) I’ve come to realize real learning is just about learning to do things not how to get things done (which may seem the same but is completely different).

I’m a big fan of Joel GTD don’t get me wrong, it is useful at work and helps getting the project shipped but learning from it is a very different story.

Some time ago I realized I was doing a lot of things (specially programming) without really knowing what I was doing and why. I mean, I developed a simple DirectX application, just for fun, very simple to learn how to program DirectX. So I grabbed a couple of tutorials, learn its way, learn how to initialize it, how to draw a couple of meshes and even have some physics involved… and then I realized I was learning nothing… I didn’t know why I was suppling each parameter for initialization, I didn’t really understand how the Directx pipeline worked, I was just repeating stuff.

I’ve known a lot of professional .NET coders who don’t really know how the CLR works, don’t even know how the IL looks like or what does it means. They get a lot of thing done but they don’t know why or how. So I started looking up a lot of stuff… but the thing is, once you start you can’t really stop anywhere… you start by looking up CLR and then you get dragged to ECMA specs and the evolution from COM model, you want to know how the garbage collector really works so you read about it and then you start seeing really interesting thinhs such as generations or collections and each thing seem to lead to another so you finally start to realize how little you know.

I think is like learning pointers, linked list, hashes, B-Trees and so on… they aren’t used so much this days as practically every modern language has a library encapsulation such a common functionality but, nonetheless, they are worth learning anyway as they give you an insight, a new way of do and think about problems.

Been reading your blog for a while (never comment) and I am not even a programmer, unless basic HTML/CSS counts (doesn’t in my book). The quote about “effortful study” and chess and golf struck a cord me. Cause it is 110% true and then some.

Growing up (and I am almost 40) I was an avid golfer. Very, very good. Went to college on a Division I golf scholarship.

My home course was on an Air Force base, where my father worked. But we lived off-base. For many years, and almost every summer day by dad would drop me off at the course as he went to work at around 7:15, have lunch with me around noon, and then pick me up after work around 6:30.

Now this was also the course my high school team played on so I could have played as many holes a day as I wanted for free. Many days, no most days I didn’t play a single hole.

Instead I practiced. I didn’t just hit balls, it was “effortful study.” I had almost a shorthand I used when I did play that noted my play in massive detail on each hole. I could analyze the score card and see if my long irons here coming up short and left of pin placements. Sand saves were an issue. The number of variables could go on and on. Putt, oh problems with putting where always on the list (I think might have held me back from being a pro BTW).

I would then practice those areas where I had a problem. Over, and over, and then over again.

Other kids would often think I was crazy, saying “lets go play Tommy, practice isn’t any fun.” Well one I made it fun and it was really, really fun to kick their asses when we did hit the course.

I maybe didn’t connect the dots entirely, but I do use a similar approach in my professional life. I’ve taught myself a lot of stuff I was never “officially” trained on by “effortful study” (and effortful practice).

I like a lot of what you write for a number of reasons. But I almost think this is a topic you could write a whole lot of articles on, cause IMHO most folks don’t get the concept.


Effortful study means constantly tackling problems at the very edge of your ability

I think you just summarized flow.

I can’t help but feel that blogging part-time along with your day job made me feel that you were somehow more involved in this very ethos yourself.

You understand that “my day job” is building, right? You can read and hear a lot more about that, here

HB wrote:
Consider something like the online banking service that you access via the web.
Considering the sheer volume of breaches that occur of online sites because of the failure of the developer to understand the underlying principles by which their tools work (e.g. SQL injection, cross site scripting, and so forth), I don’t think your example supports your argument very well.

Does that mean they aren’t “good programmers” because they didn’t write their own web server system to handle incoming requests, but instead relied on existing technologies?
I wrote “…do that [where “that” refers to the earlier “apply the solutions of others”] or build an entirely new solution from scratch…” precisely to forestall the objection that you are making. The point is that they can intelligently make a choice to do one or the other based on what is best for the given situation.

It seems to me software development is just like the construction business. You’ve got people who build the houses and you’ve got people that build the tools for people to build with.
Your analogy doesn’t match up with what I intended to say. To use your terms, what I am saying is that there are construction workers and then there are the architects who did all the math to make sure the building wouldn’t fall down, all applicable codes were complied with, and specified the tools and materials.

Again, I am carefully not saying that one is “better” (whatever that means) than another, merely that a deeper understanding makes it possible to find a more optimal solution to problems.

“Coding dojo”? Joining a real dojo wouldn’t hurt either. If it improved Josh Waitzkin’s chess, it could help your programming too.

Ah yes, another blog about self-improvement degenerating into a “who’s-better-than-another” thread in the comment area.

wow… linked by Lifehacker too ( ). Grats Jeff !

I put it to you gentlemen that having a very clear goal to pursue - even the smallest one - is the true way to advance in programming!

Never start by ‘learning’ something, follow foreign code, tutorials or all the like just for the sake of it - or some new fancy word like ‘kata’.

‘Burn’ for something, crave it! Be it a 2D game, a tool you need but you cannot yet find, a custom porn crawler because sorting manually in wads of hardcore threesomes doesn’t interest you no more, the next web 2.0 thingy, whatever!

Fighting for this - even if it takes years - will get you worked up, experienced, knowledgeable, exhausted, disenchanted and ‘practiced’ like no other!


There’s a strong likelihood that will eventually be open source – I’m probably going to follow the model and open source the code once the site is firmly established.

Beyond that, I have several mini-projects on CodePlex and CodeProject. You can look 'em up if you’re really interested.

I should have also listed as an alternative to #2, “build a commercial software product or software business”.

The best of those lists are to do with the actual programming, as I find just thinking about programming gets you nowhere. For a bit of fun I’m going to learn Prolog over the summer; at least that’s what I told myself two weeks ago after coming up with my brand-new list of stuff to read/learn over the summer.

That being said, I have benefited a lot from reading other peoples code on development forums around the Internet and by following the problems that other people face with their projects. By being a bit more social with your programming you can probably learn a lot more than just sitting at a desk on your own all day.

Right then, I’m off to do some drills.