Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

IT Professionals

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

    Search

    XML Feeds

    Google Ads

    « Review of In The Plex: How Google Thinks, Works, and Shapes Our Lives by Stephen LevyPlaintextoffenders.com »
    comments

    Feelings about programming katas tend to fall into one of 3 buckets; disdain, indifference, or appreciation. The indifferent crowd generally doesn't see what you learn from repeating the same coding exercise, while the disdainful crowd feels the same way, but at a much louder (and of course disdainful) volume. That leaves the group that feel there is value in repetitively coding the same exercise or coding numerous small code examples.

    I was in the indifferent group, but then I tried it.

    Where I Started

    After finishing The Clean Coder recently, I decided to give this kata thing a try. I started out with a fairly simple problem in a language I was comfortable with and spent 15-30 minutes each night trying a different variant or constraint. What I found was that even the act of setting up for a kata was a learning experience, in one case learning an entirely new unit test framework before I could even begin.

    Fast forward a couple weeks and I think this is becoming a regular part of my ongoing development. I've even taken to synching my local mercurial repositories up to my BitBucket account so that others can take advantage of the pre-setup projects and test scenarios. (I haven't quite embraced the throw-away aspect yet, but I suspect I won't be keeping all of my repetitive attempts.)

    In the past several weeks I've gained a lot more practice with mercurial, played with some concepts in C# (like Continuation Passing Style), and started digging into unit testing JavaScript. I've learned markdown simply by spending an hour or two formatting a series of text documents (an uninspired exercise, I'll admit) and .. well, for the not much time investment I can already see that this will be a good habit to add.

    Why (or How) it Works

    So why, then, do people do this? Obviously it takes time to write a program, no matter how small. Robert C. Martin, author of The Clean Coder above, swears by this practice. Jeff Atwood is another who wrote about katas. Dave Thomas (first kata link below) introduced the term as co-author of The Pragmatic Programmer.

    But where is the value in repeating a simple exercise?

    The Challenge

    The first thing that struck me about code katas is their similarity to forum questions the LTD group used to hijack, back in the day. Someone would come up with a perfectly reasonable solution to a somewhat reasonable problem, then 2 or 3 of us would turn it into a 30 reply post, each trying to find a shorter, faster, whackier, whatever-er method of solving the same problem. In fact, the reason I learned how to use python and perl in classic ASP web pages was due to challenges like this.

    The value of short, varied approaches is it forces us to stretch our knowledge of a language or syntax. Playing with constraints (performance, code length, memory limits, etc) help us explore more about a language or technology and choosing a short exercise as a base means we spend most of our time in that exploration, rather than in the act of retyping a solution or having to build a large structure to work with.

    Focus

    By selecting a fairly simple problem, we can choose to focus on any other aspect of programming that we want. Besides introducing rules or constraints to make the program more challenging, we can also use repetition of a simple, known problem to better get to know our tools or learn new supporting tools. Examples include improving use of keyboard shortcuts, trying out methods like TDD, and training ourselves on new habits or standards. By working on something we already know the answer to, we are free to play with the aspects of how we get to that answer.

    No Loss

    The last benefit to a programming kata is we can throw it away when we're done or even stop it halfway and simply delete it. Whatever aspect we have chosen to focus on or challenge ourselves with, this is still a small bit of practice code. Rather than trying to learn something new with a piece of code we will eventually have to support, we can play in a sandbox and put it away when we're done.

    Where Can You Start

    So, if you wanted to try this out, where could you start?

    • CodeKata.PragProg.com - Dave Thomas has listed 21 programming and non-programming exercises
    • Forums - Find a forum question that requires more than 5 lines of code for an answer. Write it, reinvent it, mix, repeat
    • Coding Dojo - A catalog of 23 katas
    • Project Euler - a series of challenging math problems that make excellent practice problems
    • TopCoder - Though it exists as a programming competition, the sample and practice problems at TopCoder make good katas (if you can get the crash-friendly interface to work and find them, that is)
    • Blogging - Writing about a topic forces us to explore and better define or communicate it

    The best way to start is to pick something you feel like you can finish in 15-30 minutes and try to do a variant of it every day or two. If you feel like you're not getting any value out of it after a week or two, you can stop; your time investment has been low. If you do start seeing some value in it, though, you have another tool for keeping your skills relevant and sharp.

    About the Author

    User bio imageEli delivers software and technology solutions for a living. His roles have included lone developer, accidental DBA, team lead, and even unintentional Solaris consultant once. With experience in adhoc, Lean, and Agile environments across NSF grants, SaaS products, and in-house IT groups, he is just as willing to chat about the principles of Lean or Continuous Delivery as he is to dive into Azure, SQL Server, or the last ATDD project he created.
    Social SitingsTwitterLinkedInHomePagedeliciousLTD RSS Feed
    InstapaperVote on HN

    4 comments

    Comment from: chopstik [Member]
    chopstik I was turned onto code katas earlier this year as a result of a training class where the instructor strongly suggested we try it. While I freely admit that I only do them intermittently (though I may try to be more proactive now since I have moved away from programming recently), I found them to be useful for learning new things. Especially given as I typically only learned what I needed to get the job done (especially in the last 3+ years). Now, with the katas, I'm more inclined to learn new things again and, as you pointed out, other than the time, nothing is really lost in trying them.
    09/20/11 @ 07:08
    Comment from: Abhishek [Visitor]
    Abhishek nice blog..
    09/21/11 @ 11:43
    Comment from: itoctopus [Visitor] · http://www.itoctopus.com
    itoctopus Add one more category to your list (disdain, indifference, or appreciation), those (such as myself) who don't know what kata is...
    10/04/11 @ 04:53
    Comment from: Eli Weinstock-Herman (tarwn) [Member]
    Eli Weinstock-Herman (tarwn) I think I assumed that people that didn't know what programming kata's were wouldn't have strong feelings about them :) However I probably should have taken a moment to explain what a kata is (purposeful practice) in this post, sorry about that. Jeff Atwood's post above does a good job of explaining them.
    10/04/11 @ 06:43

    Leave a comment


    Your email address will not be revealed on this site.

    To mislead the spambots.

    Your URL will be displayed.
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)