Hacker News new | ask | show | jobs
by mrcoder111 2786 days ago
I'm a recent college grad from a good CS program. How do I get better at bugfixing and diagnosing code? To give a specific example: I was recently working with a Tensorflow code base for image recognition, and Tensorflow kept hanging (no error, just hanging) or giving me shape errors. I felt stuck. First, the lack of error made it hard to diagnose, and when I did get the shape error, I didn't understand why quickly. I find myself too dependent on stackoverflow for bugfixing and if someone hasn't solved it, I feel helpless. I've tried reading through the Tensorflow source but it's pretty verbose and hard to understand. Are there any books that give you concrete methods to really understand other people's code well and fix bugs?
3 comments

In my understanding, to begin learning diagnosing issues in code you need to understand your stack very well. Try to invest time explicitly learning bits and pieces of how your platform works, in detail.

Once you learn few different platforms and spend some time diagnosing problems you will start recognizing recurring patterns in problems. Hopefully this will gradually become your ability to diagnose difficult issues on unfamiliar platforms.

Pair with a strong senior developer, and observe as they troubleshoot. Learn troubleshooting and debugging tools like gdb, ldd, nm, strace for Linux, or SysInternals & Visual Studio debugger for Windows. Troubleshooting, debugging and diagnostics are skills in themselves that will stand you in good stead going forward.
Juniors I know all need to focus on the error message: read it, understand it, and then apply the scientific method : formulate one hypothesis, test it, analyse results, rince and repeat. Each experiment should other a path to what's next.

They are also forbidden to stay stuck more than one hour without requesting feedback(actually that's a rule for everyone on my team).

Pairing with seniors is a great way to learn too, you'll discover tons about what makes your company's code special.

You can block stackoverflow.com, or at the very least avoid searching on it before having tried to __understand__, not solve, the issue.