Edge Cases of Tomorrow

3 minute read

Contains spoilers for Edge of Tomorrow

Edge of Tomorrow is the latest Tom Cruise vehicle based on All You Need Is Kill but the ending has been sugar coated as Hollywood love to do. The basic premise is an alien invades and the earth has got to the point where they’re making their last stand. Enter Tom Cruise, who is not in a position to save the world, yet. Luckily the alien he accidentally kills gives him the power to control time, until he dies and then the day resets. He doesn’t realise it’s happening until he dies a few times and then starts tweaking things, trying to save someone here and there, learn something about people he can use later, etc… The problem is he has to die, he has to start again from the beginning to get back to the point where he made a mistake that killed him. To me that sounds like Extreme Refactoring, although as the movie pans out it doesn’t repeat all the steps just the last few so it looks more like Test Driven (Plot) Development (TDD). The point I’m making here is to really get the best outcome you might have to try a few things out, take different paths, make horrible mistakes but luckily in software development you don’t have to die over and over. However, you might save the world ;)

A safer alternative

This is where the concept of the code kata comes in. Code kata was coined by Dave Thomas and there 21 of them his CodeKata site. The idea behind Code Kata is that you repeat the same problem over and over. Unlike Tom Cruise when he’s perfecting his killing technique against the insanely fast and unpredictable aliens to ultimately defeat the big bad boss alien you’re doing it to improve your technique and perhaps explore different ways of solving the same problem. In Kung Fu a kata is usually called a form and while I did Karate when I was younger I don’t have strong memories of it. In my late 20s I spent a fair bit of time practising Hung Ga so I have some experience I can pull from there. If you ever have the pleasure of learning this (or any other) style of Kung Fu it might go something like this:

  • Once a week you’ll learn 5-10 new moves of a form
  • During the week you’ll practise those moves until you can do them without thinking
  • The next week you’ll learn 5-10 more new moves
  • Again you’ll practise those moves and those you already know
  • Eventually you’ll learn the whole form
  • In other classes you’ll get a deeper understanding of the moves
  • While sparing you’ll find your using the moves you’ve learned
  • Then you might do some form of testing to prove what you’ve learned
  • But it’s not over, you’ll continue to learn and get a deeper understanding as you learn more advanced forms

It sounds like this sort of repetition would get boring but as you’re learning more each time, improving your technique, understanding and feeling your way around the moves, you get better at it a little at a time. This mirrors a lot of what I hope to do by doing the same piece of Code or problem over and over. I’m not doing it because I want to learn how to solve the same problem perfectly, in fact I’d rather make mistakes and learn something new from them. This reminds me of sparing, which is a relatively safe way of learning on your feet but under pressure you make mistakes, you try new things out. You might get a few punches or kicks where it hurts but you need that to learn. And like Tom Cruise in the movie you might realise you’ve boxed yourself into a bad path so have to take a completely different approach from the very start.

Leave a Comment