# How I Learned to Code Better

What would you do if you wanted to noticeably improve your programming skills in one semester? Last term, instead of having fun in Singapore like my peers, I chose to stay in Waterloo to hone my coding abilities. To gauge my limits, I enrolled in four CS courses of the highest quality: Programming Languages (CS 442), Compilers (CS 444), Artificial Intelligence (CS 486), and Big Data (CS 489). These courses comprised both challenging theory and tricky implementation in spades. My efforts have improved my programming skills by, I felt, around 30%.

I learned not only useful concepts, but also discipline from writing code nearly everyday. Implementing the term-long Java compiler, in particular, soaked up lots of time — and patience from coaxing and nagging at my teammates. Weekly Big Data homework also nailed me to my computer on weekends. But because I spent so much time tackling assignments that improve my programming skills by design, I got a lot better at architecting and implementing complex programs.

Aside from writing better code, I also distilled the most theoretically intriguing and practically useful algorithms from these courses. I summarized these below:

• Simulated annealing: the formalization of “why we should take more risks when we’re younger”.
• Reinforcement learning: “a good guess for a state’s value is its immediate reward + (discounted) guesses of future states’ values”.
• Hindley-Milner type inference: the type of if a then b else c is “get b and c to look the same”. Also, pass along constraints in the form of substitutions. Fresh type variables are often useful.
• Monads hold data or code, and allow functions to access them.
• Continuations are mind-boggling functional goto statements.
• Difference lists are mind-boggling functional deques.
• Min-hashing: a clever trick to estimate how similar two sets are by hashing their elements.
• Reservoir sampling: how to pick n items from a stream in an unbiased way.
• Hyperloglog, bloom filter, count-min sketches: more ways to exploit hashing to estimate cardinality/membership/frequencies of datasets.

As for miscellaneous skills that may be useful at work, I learned to write x86 assembly, Haskell, and SML, and use Hadoop and Spark.

It was an enriching semester, even though there was an endless amount of homework — I felt a lot stronger as a developer and computer scientist. Would I take four CS courses again? I doubt it, since there weren’t many useful CS courses left. But the most practical skill I picked up was probably how to drive on the highway, from Waterloo to Toronto and back.