Slain wrote:
I am a new hire in a company and have started working for the
development team. Ofcourse, I took some C++ courses in my grad school,
but there is such a big difference in the programs you encounter at
school versus here, where it sems there is a completely different
style of writing.
Is there some tool etc to help understand some one else's code. I have
been given some responsibilities to fix some minor defects, which
involves understanding some one else's code. Any pointers would be
helpful.
Version control. It can get you the information who was the last one
to touch the code, or who made the most changes to it. It is fair to
speculate that the person who's already seen the code would know more
about it. Ask him/her.
The code is supposed to be documented (comments, separate electronic
and other diagrams and tables). Read the documentation. If reading
the electronic portion requires special software, use it.
Debugger. Step through the code to see what it does, where execution
takes you, and how the values change.
Document your changes to the code, observe the changes in behaviour.
If you can keep it all in your head, good, otherwise use some type of
sandbox in the same version control software.
There are tools out there that can reverse-engineer C++ code and draw
class diagrams, entity diagrams, etc. I haven't tried any of them,
but I heard of people who heard of people who swory by those.
Doxygen is one quite popular. Also, most IDEs nowadays have some cross-
to the function declaration and so on.