I'm curious about dealing with code that has strange names for variables, functions, and methods. Do you usually try to reverse engineer them or step through the code? Or is there some approach that might not be commonly known? I'm not even sure what to look up to improve my skills—any suggestions? Also, does competitive programming have anything to offer on this front?
4 Answers
I usually start by checking the comment block right above the function. If they have documented what the function does, that can clear up a lot of confusion. But if there are no comments, that's a bigger problem!
If you encounter strange method names in a framework, the best approach is to read the documentation or do a quick search online. You should only need to reverse engineer if the documentation is lacking, or if you’re poking around in some JavaScript from a website.
What do you mean by 'deal with'? Are you trying to understand or modify the code? Clarifying your goal could help get better advice!
It helps to look for examples in the code. Generally, unless the naming is intentionally confusing, developers usually try to choose meaningful names. If you're struggling to understand a name, it might mean you don't have the same context as the author. Take a look at how the function is used elsewhere in the code—this can provide hints about its purpose. Trying to figure out their thought process can be really helpful!
Exactly! Sometimes the best example is just the code itself, especially when you're looking for clarity.

It's true! Naming things is super tricky. They say it’s one of the hardest parts of programming. The other tough things? Cache invalidation and those pesky off-by-one errors.