I recently joined small software company and have been assigned to project in which one of team member is very senior has been working on the same code base for about 7 years.
Part of my assignment is to maintain this code base. There is not much comments in the code neither any documentation. I am struggling to understand the code and part of the reason asking senior lot of questions regarding various scenario logic of the code. My manager get very angry when I ask code related questions. According to him, I should be capable of understanding the code on my own.
Once I had a chance to implement a new logic. So I did – to take revenge I did not put any comment to the code. Now this senior is struggling to understand my logic. He came and asked me to make him understand the logic. I just smiled and explained.
Question: I am not sure how to approach the legacy code and gain trust. The Manager and this senior are working together for a very long time. It is becoming very difficult to gain his trust.
Edit: I myself have two years of experience from previous job. Where the practice is to have design documents/commenting code.
Edit: Thanks for all the Answers . I accepted the one which has list of points to be followed. The OP has a specific question[not broad] about how to work with angry manager[gain trust] when working with legacy code. The 3rd paragraph of OP is to demonstrate, all fail to understand the logic of the code sometimes.