Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

At my previous job I was debugging a problem that a client ran into. Looking back, these are some of the steps I took:

1. Recreate problem in prod - How was it triggered? I did a bit of digging and noticed that it happened when very specific conditions occurred.

2. Recreate it locally - Got an error message, i.e. `SomeVar is not defined`.

3. SomeVar - Why is it `undefined`? I started working backwards and realized that the `SomeVar` functionality was working as intended, but it's what was being fed into it that was the issue.

4. Working backwards - I had a hunch as to why the error was occurring when I started, and when I worked backwards I realized that I was partially correct.

5. More research - In regards to point 4, I learned what else was missing (i.e. why I was partially correct about my hunch).

6. Start coding - Since the issue was in prod, I put in a pretty shoddy hotfix. It worked, but it tacked on some logic into code that was already pretty confusing (due to a lot of conditional scenarios in the UI).

7. PR - I opened a PR, but to my Sr Dev's point the solution worked but the code wasn't clean.

8. Sr Dev chat - We had a quick chat, and even though the issue was in prod only a few people had it happening to them (the feature wasn't widely used). Also, unless we were actively losing money due to a prod issue, a hotfix isn't needed and we can take the time to write cleanly.

9. Coding - I realized that there was an even easier way to write the code without introducing confusing logic. I scrapped about 95% of what I had and put in something that not only worked, but was much cleaner. I also wrote some tests, as per the Sr's recommendation.

10. Updated PR - I followed-up with the Sr, who thanked me for revising the code and for writing the tests.

---

Although I reached the original solution and the new one on my own, having discussions with the Senior Dev was incredibly beneficial.



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: