Questions For Coding

Photo by Timothy Dykes on Unsplash

For a three month-long code bootcamp I've had the following (taken from a written lesson if I recall) scribbled on the front page of my notepad.

It's a step-by-step thought process to use when you're stuck coding (with some personal modifications).

HAVE I???...

  • ...really understood the problem??
  • ...pseudo-coded a solution?
  • ...googled the error message/ related or similar problems?
  • ...actually READ the error message or the documentation?
  • ...double-checked my syntax?
  • ...linted my code? (rarely in my experience so far has this been the issue...)
  • ...rubber ducked the problem?
  • ...pair-programmed or had a peer review my code?
  • ...walked away from my computer and taken a break??

At any point I'd say you could walk away from the computer and take a 10-30 minute break. I've had more epiphanies away from my computer so far, than I have had trying to brute force a solution by gluing my butt to the chair.

If you don't know what rubber ducking a problem is – I certainly didn't before school – you basically talk through your problem with a rubber duck. It's a thing in comp sci. Basically it forces you to verbalize the issue and talk it through. Talking to an imaginary friend about the problem likely works just a well.

For the bolded pair-programming/ code-review I'd argue it's a lot like coaching and bringing in an external pair of eyes to look for things that you cannot see.

Human beings lack really effective personal awareness systems. We fail to see a lot of what we do. That external pair of eyes is paramount, so in the absence of mentors (from school) I've been using CodeMentor. I don't get anything to tell you that, I just think it's cool.

Sometimes (often times?) you just have to move on and come back to something with fresh eyes.

I used to wonder why so many tech companies had video games, ping pong or pool tables in the office. I don't wonder anymore. When you're thinking that intensely, staring at a screen for too long the most effective thing you can do is stimulate your brain in an entirely different way. I don't favour video games in this context myself but physical activity I completely understand.

Seriously, you don't know until you've tried it. Regular breaks are useful, despite my reluctance to take them.

Mostly I just wanted to tear this page off my notepad and put it somewhere else for reference. This seemed like a decent place. 😉

Darren Beattie

Read more posts by this author.