I'm tasked with a complicated bug fix within a massive legacy codebase that is dependency hell with undocumented spaghetti code. I've been debugging an issue for a few days and have absolutely no idea what to do next. I don't understand the code and no one else does either. I asked my lead what to do and he said to set breakpoints and read the code. I asked where. He said doesn't know. I've been systematically debugging the issue using every technique I could find on Stack Overflow and books like Code Complete/Debugging. Logs doesn't indicate any useful information. There are no error messages or exceptions. There are no unit tests. All the domain experts I could possibly ask have left. Basically there's no one to help, reading the code and debugging isn't giving me any meaningful data points. I have a general idea what's wrong and where it's happening but my mental model of the application is still weak and things just aren't clicking. I'm super frustrated and feel stuck. I'm also in the middle of a job search and feel like a totally incompetent dev who deserves to rot here for life. TC: 95k. YOE: 2
Hey try your best, and keep job search
Keep leetcoding
Probably gonna go with this.
Are you telling me there is no senior in your team? Given you have only 2 years of experience I doubt that. No matter what if you are stuck always and always ask for help! If your lead is not helping escalate to your manager. It's his job to help! Also you can chk the history of file for write and reach out to guys who would have worked on it.
The most important thing to do is understand what the code is supposed to do. If you don’t understand that, it’s hopeless. After that, put some print statements into the code so you can see order of events, and what’s happening. I was once asked to review a bug fix to the worst legacy code I’ve ever seen. There were goto statements all over. Dozens of bugs had been entered against it for over a decade. I rejected the fix, because no one could say with certainty that there were no other bugs. So I decided to spend a day writing down all the code paths and developing an idea of what was supposed to happen. At that point, I threw the original code in the trash and rewrote a critical function from scratch in a clear and concise way. The next year I was on the project, there was never again an issue. Moral of the story: sometimes the second step should be to throw some part of the old code in the garbage and start from scratch. (The first step being understanding the task at hand.)
Thank you, I appreciate the insight.
This. I recently was working in a piece of code that didn’t make much sense. Then I tried to look at the big picture and suddenly I could understand the code and also propose a much simpler solution.
Leave.
Rewrite it - leave - watch the next one throw up their hands in despair 😀 The cycle goes on...
So evil, but rewrite it is basically killing yourself twice.
Sounds like FB infra? Op are you in FB lol
Nope I'm in HPE unfortunately, but now I know FB infra is not where I wanna go to next
Yeah, you got pretty unlucky. Try to ask to be assigned to another task (assuming this bug isn’t an emergency) if you’re just getting started at HPE. Debugging issues in that type of code base is gonna suck regardless of how good you are. Find a new team/company if you think you’re gonna be working on that kind of stuff for a while
I too had similar experience. Sometimes we get stuck and leads too hardly seem to know anything. For most, it is easier said being done. I agree with op completely. And lastly on scale setups, logs have hardly any value. Luckyly we have a couple of domain experts which we check with in such situations
You are a competent dev that is in the wrong place. Of course all of this is not revealed during interviewing. The only way out of this is to get out of that team or that company. With that much technical debt, it only gets worse from here onward.
Thanks, will keep this mind. I was thinking of jumping into another team if my job hunt isn't successful, but I'll probably keep leetcoding...