Zamansky Live Codes Advent of Code 2016 #2

Mike Zamansky who is, after all, a teacher, demonstrates his coding technique by live coding the second exercise in the 2016 Advent of Code. He is coding in C++ because that’s what he’s teaching at the moment but even if, like me, it’s not your favorite language, it’s still a nice introduction to a certain style of coding.

That style is basically ensuring that each little piece of your code is working before you move onto to the next piece. That’s the technique that I use and love when I’m coding in Lisp. The REPL makes it really easy because you can execute a single statement and see what the result is without having to add special scaffolding. It’s a little harder in a C-like language but not, as Zamansky shows, impossible.

Note that this is a bit different from Test Driven Development. You’re merely trying to discover your errors as soon as possible rather than trying for a rigorous demonstration of correctness at each step. Since starting to program in Lisp, I use this technique no matter what language I’m using. Still, it works best in a REPL-driven language like Lisp.

Another point the video makes is the importance of data representation. By choosing a good representation you can reduce the complexity of your code and also make it easier to adjust to changes in the specifications of the problem you’re trying to solve.

The video is 17 minutes so plan accordingly.

This entry was posted in Programming and tagged , . Bookmark the permalink.