The Startup
Published in

The Startup

Photo by Max Duzij on Unsplash

Four shortcuts for finding bugs in a large or unfamiliar codebase

Some months ago, I started a new position as a software developer at Nucleus Security.

Nucleus has a cybersecurity SaaS (Software as a Service) that helps information security analysts streamline and add automation and better reporting to a complicated and, apparently, often hellacious process called Vulnerability Management.

Our app’s codebase is large. As I’ve been learning my way around it, I picked up a few clever ways from my own discoveries and my teammates’ insights to quickly find the lines of codes related to whatever issue or bug that’s assigned to me.

#1 — Use text in the UI and the search feature in your IDE

A quick n’ dirty way to find the lines you need is to find some text in the UI of the application and then leverage the search feature in your IDE to search for that text.

If you’re lucky, the text will be unique in the application and you can quickly narrow down the lines in the file or files you need to work on.

If you know your issue is on the frontend, you can also inspect with the Chrome DevTools to find the names of fields in the UI and then search using your IDE to find those field names.

#2 — Use the Network tab in the Chrome DevTools

Randomly experimenting one day, I discovered you can see JavaScript method (i.e. function) calls by clicking on the names of the HTTP requests in the Network tab of the Chrome DevTools and then clicking on the Initiator tab.

When you find a method on a request that looks like it might be related to the issue or bug you’re working on, you can go back to our IDE and search for that function in the code across all your files.

(I use VS Code and all I do is click on the magnifying glass icon in the toolbar on the side to initiate a search like this.)

#3 — Use JavaScript’s built-in debugger

Once you know generally where the code is, drop a debugger and maybe even a console.log() in that spot to confirm or (disprove) your assumptions. By doing this, you’ll avoid wasting time by messing with code unrelated to the issue or problem you need to work on. (Been there before!)

4 — Ask someone familiar with the codebase

This may seem absurdly obvious, but many of us, even as adults, are afraid of making ourselves vulnerable or feeling dumb when asking for help. Now, I understand that in this field, some people have personalities that don’t invite the asking of questions.

To be blunt, tap into your grit and ask for the help you need even if it means you might be made to feel like a pest or of lesser intelligence. Whether you get the response you want or not, at least you can add an entry to your courage journal. (What do you mean you don’t have a courage journal? Doesn’t everyone have one?)

Of course, it does seem wise for learning purposes and so as not to annoy your colleagues too much, to grind away at the problem independently for a bit before asking for help. But after a half-hour or an hour of struggle, it might be time to reach for that lifeline. Most people in my experience are wired to want to help, even the “tough” personalities.

Plus, drawing on my background in marketing, I know that the phrase “I need your help.” triggers all sorts of positive psychobiological reactions in most human beings. So, I think you’re likely to get a favorable response by choosing courage.

Thanks for reading these four shortcuts to finding the code you need to fix a bug or address an issue. I’d love to learn from you too. If you have other shortcuts related to this topic and are keen to share, please drop your insights into the comments.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adam Dudley

Adam Dudley

20 Followers

Life’s too short for bad coffee! Business and marketing guy. I love science, tech, startups, and philosophy. I practice Mysore Style Ashtanga Yoga 6 days/week.