How I fix bugs
1 min readSep 4, 2022
- First, if possible, I reproduce the bug and check what’s wrong: what’s not working or working but not in the desired way
- I look for the piece/pieces of code where the bug occurs and track the changes in the data
- Depending on what I’m working on, I try to get more insight into the data.
If it’s in JavaScript, I use:
console.log(data)
If it’s in Ruby, I use:
binding.pry
If it’s in haml, I use:
%p data
- If needed, I put these on every other line of code and inspect the changes in the data flow
- Usually, by this time, it’s already obvious what’s wrong so I start fixing the bug (and google if I get stuck)
Fixing bugs is an essential part of a Software Engineer’s job whether you like it or not. Treat it as a way to advance your skills and get valuable experience, and maybe someday you’ll start enjoying it (or not).
How do you usually fix bugs?