Welcome!
Hi this is John with this week’s Developing Skills - Skills for Developers looking to develop their careers.
🙏 Thank you for being one of the 11,937 software developers who have subscribed, I’m honoured to have you as a reader. 🎉
If there is a topic you’d like to see covered, please let me know by replying to this email📧
This week I have a guest post from Matt Boyle, an engineering manager with a passion for debugging and Go. He’s the author of the course “The Ultimate Guide to Debugging With Go” - link and discount for readers at the end of this post!
Tip of The Week: Level Up By Learning To Debug
A few months ago one of my followers on twitter (X?) reached out to me to ask for some help figuring out an issue with their code. After exchanging a few messages, I suggested we have a call instead.
After some exchange of pleasantries (I am British, after all; it's essential that every conversation begins with a five-minute discussion about the weather), I asked him to show me the issue he was seeing. I was shocked at what happened next.
He added a bunch of logs to his application at various points and ran his application. The application had some concurrency involved (it was a web app) and so the ordering was a little unpredictable and hard to follow.
Me: “Why don’t we try setting a breakpoint on line 132”.
Him: “What’s a breakpoint?”.
Me: “You can just click in the gutter on line 132 and start the debugger”.
Him: “What’s the debugger?”
We spent the rest of the session learning the basics of the debugger and he was able to resolve his own issue (there was a value missing on a configuration struct).
This session really stuck with me because it made me reflect on my own ability to debug, and how I had learnt the things I had. None of it was taught to me at University or specifically on any training I had ever done; it was always learnt opportunistically in a situation like I described above. I believe being able to debug locally and in production is a critical skill for any engineer, so maybe we should make more effort to teach it. This encounter led to me creating The Ultimate Guide to Debugging With Go course, but I believe what I teach in that course is mostly language agnostic.
If you are looking to get better at debugging, below are some topics to explore with a short explanation of why I think they are important. I have included links to resources for some popular languages, but if you google the phrase you should be able to find them for your language too!
The Debugger
It will be no surprise from the story I have told that using the debugger is a skill I think every engineer should learn. Surprisingly (to me), this view is somewhat controversial; I wrote about that here.
If you do want to learn about the debugger, I find the easiest way to start is to use the IntelliJ IDEs (Goland, php storm, IDEA, etc). The Jetbrains site contains detailed guides for debugging for all of their IDEs. For most languages I have tried (except php) the experience is similar and easy to get going with.
Logging
It might seem from the story I shared that I am not a fan of logging. That couldn't be further from the truth. I do believe logging should be part of a bigger observability strategy, though.
Structured logging can really help make your logs useful, and I recommend using a logger that supports it.
Making a system easy to debug is a journey, and logging is an easy and understandable place to start. You may find you use logging less and less as you increase your observability.
Metrics
Image courtesy of grafana.com
After you have a good logging strategy, it's time to start thinking about some pretty dashboards to show business metrics. Prometheus and Grafana seem to be the de-facto standard here, and I really like the look of this beginner’s guide which talks you through where these might be useful in a language agnostic fashion.
Prometheus publishes clients for some popular languages:
And then there is unofficial, community maintained clients for other languages:
Tracing
Image courtesy of datadog.com
Debugging a system isn’t always about finding a logic error, sometimes it can be about discovering inefficiencies that can impact user experience. Training is a great way to figure out where your system is spending the time. Tracing is not just for distributed systems either, even in monolithic applications, instrumenting critical sections and communication with dependencies (such as your database) can be very valuable.
You have tons of options for doing this at various price points. Some of my favorite tools are Sentry, datadog, Jaeger and New Relic.
Wrapping Up
I hope this helps you start out on your journey to become better at debugging. If you have a good understanding of the above (as well as unit testing) you will be in a really strong position to be an excellent contributor at any company you might end up at.
If you enjoyed this blog and are interested in diving deeper into the topic covered here (plus a couple more) in a lot more detail, you can get 30% off of my course using the discount code DEVELOPSKILLS.
Go not your thing? No worries. I really enjoyed the Build your own Docker coding challenge and if you can complete it without using the debugger, you are a much better developer than I!
Matthew Boyle is an experienced technical leader in the field of distributed systems, specializing in using Go.
He has worked at huge companies such as Cloudflare and General Electric, as well as exciting high-growth startups such as Curve and Crowdcube.
Matt has been writing Go for production since 2018 and often shares blog posts and fun trivia about Go over on Twitter.
> What’s the debugger?
This trend on X reappears every couple of months: console.log is the best debugger!
While log lines are cool and definitely give great value for the time invested, the problem is that when beginners see this, they never really take the time to go further and actually learn to use the DevTools (speaking of web apps), which is something you must know to uncover more difficult bugs, memory hogs, or leaks.
It's not uncommon for someone with years of experience developing web apps to see the debugger for the first time.
Awesome topic. Learning the effective ways of debugging is crucial for any software engineer to level up and perform effectively in their job. We're not just paid to build stuff, but also to fire fight, quickly.
I find the tracing tools that you mentioned super helpful. We use Jaeger in my team. And, it's very useful to know where the bottlenecks are. Especially while debugging parallelism issue or database issues. Which are the worst!