Reflecting on the whiteboard
Recently, I had an opportunity to design a method the whiteboard. As a follow up, I was asked what I would do differently. After working out the problem in a terminal where I could execute and debug the challenge, I was able to run though the exercise on my own whiteboard.
My first observation is that the whiteboard is a great place the visualize any problem. The first step should be creating a clear diagram on the initial and final states of the data structure. Especially when a method needs to make confusing transformations, like setting up to down or left to right, a clear diagram will really help you visualize a complex transformation and help avoid common errors.
Next, it seems obvious that you should walk through the challenge and write down the steps of any transformation. If you can’t write down the steps, you’re not ready to write code, so take time to write down the steps.
Finally, pick a language that is clear and explicit. Although I’ve written a lot of Ruby in the past ten years, leaving off parenthesis, semi-colons and curly braces does not make my hand-written code more readable. I’ve decided TypeScript is one of the best languages to writing out coding challenges on the whiteboard. When my brain is the parser and compiler, type hinds in TypeScript are really helpful.
I’m not confident that the ability to write excellent code on the whiteboard makes one a better coder, but there is something to be said for organizing your thoughts and allowing those thoughts to flow from a dry erase marker.