Hacker News new | ask | show | jobs
by runningmike 34 days ago
Assuming you have a c or cpp project: compile and build it first , run the tests if any.. and run cscope or equivalent on code you want to change first.
1 comments

Yeah, that's ok. But if I am completely unaware about the code, I don't know what to search in cscope, or anything about the flow of the code. How do we manage in that situation?
Do you have a specific task you need to do in this code? If so, search for something related to whatever that is - text from the UX, data, fieldnames, etc. Once you find one spot in the code related to your task, follow the code back and forth to figure out that feature.

And if you have no task you are aiming at, find the main entry point of the code and start tracing where it goes.

But either way, I would not actually start with the code. The code glues together the data and the UX, so go figure those out first. Use the app. Browse the data schema. Figure out some connections. Once you understand that "datum A" is used in "UX widget B", the code just becomes a middle point to step through to connect them. And stepping through it once for one data field will likely teach you the patterns used in the codebase, so you can apply that learning to everything else.

And don't forget to read documentation. It isn't always kept up to date, but something is better than nothing.