Code Challenge Usability Testing

Coding Challenges have become a common step in the Software engineering interview process. I have had to review a couple challenges and the biggest mistake is a lack of usability testing. People are usually in a rush when they do coding challenges, either to limit the amount of time they are spending, or because they decided to attempt something challenging and time is running out. When we do side projects we often think that because its just us less complications will come up and our estimates will be more accurate. But the reality is that the project is still going to take longer than you expected. 

Since most coding challenges end up being rushed, its surprisingly easy to stand out through usability testing. Ask a friend to clone your repository and try to get the code running without any support on your end. A surprising number of code samples and challenges don’t even start once they get into the interviewers hands. Or even worse, your code works perfectly, but the interviewers don’t realize it because you didn’t document what the ‘working’ state looked like well enough. 

It might seem like a simple thing to do, but just having two people try to start your app and give you feedback can result in a smooth stress free review of your code sample and give you a strong foot in the door. 

Using pprof to examine the heap and memory usage in Golang Programs

I had some trouble getting the info I needed to setup pprof in my program. And figuring out the steps to get actionable data out of pprof. So here is my attempt to provide the minimum steps needed to use pprof.

Instrument your code

import (     
   _ "net/http/pprof"         
    ) 
func main() {     
   go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }() 
//Your program 
}

Make sure you have the above in your main.go file. This sets up a webserver that provides pprof data at the below link.

localhost:6060/debug/pprof/

Heap Memory Usage

In your shell run: go tool pprof http://localhost:6060/debug/pprof/heap This will open a cli program, enter top into the prompt.

go tool proof http://localhost:6060/debug/pprof/heap

This gives you the top 10 nodes of memory usage. It will truncate the results if most of the memory is in the top 3 nodes.

CPU time

To sample 30 seconds of cpu time, with 50ms of time ‘sampled’. go tool pprof http://localhost:6060/debug/pprof/profile

go tool proof http://localhost:6060/debug/pprof/profile

    pprof Godoc:   https://golang.org/pkg/net/http/pprof/