Slain said:
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.
Bug fixing is one of the first thing usually given to someone new to a
company for just that reason, so they can start to understand the code.
Also, you'll find that >80% of the time you'll be fixing programs rather
than writing new ones. Maintainance is a big part of being a professional
programmer.
Anyway, to start out what I always did was trace backwards. For example,
they tell me that some box on some edit form is showing the wrong number,
I'll look at the edit form (or report, or screen, or whatever), find out
whree it's being displayed, then find out where it's being
displayed/printed/shown in the code. Sometimes it's a simple variable, then
I'll trace back where that variable comes from. Sometimes it's a formula,
then I'll have to figure out how the formula is calculated, etc...
Make absolutely sure you know you are changing the right thing before you
change it, then document it. Something like:
showField( Foo, age * weight + height );
then you make a change
// replaced line 7/16/07 JML - Formula wrong
//showField( Foo, age * weight + height );
showField( Foo, age * weight + height - bodymass );
I'll then usually find a programmer that's been around a while, show him
what I found, what I'm fixing. They'll usually say, yeah, looks good, then
I''ll remove the commented out line (if it's how its done there). In one
company lines changed needed the old line left in. One company didn't want
it.
It will probably take a while of fixing things like this until you start to
see a pattern in code, how they call their functions, etc... then it'll
become easier.
Good luck!