Sometimes it seems to me that people ask for code-reviews just so they would be able to say Xyz reviewed my code!(1) when something broke.Question, is that ever the case? (Or is it just my imagination)If it is, how do I handle this?(1): What s/he really meant: It's Xyz's fault or something along those lines.
How to make code-review feel less like a way to *shift* the responsibility?
code reviews
If the first thing a developer thinks when their code fails is shifting the blame, it sounds like a broader cultural issue. Does the developer feel too attached to their code and so is their ego to blame? Is the developer inexperienced or feel they have something to prove?Alternatively, does management yell at developers for defects and say nothing when things work? Is the team under pressure to shed headcount? Are developers uncomfortable with technologies and processes? When developers are told to fix an issue, do they feel they are blamed?Everyone makes mistakes. The best software developers admit it, learn from it and move on. However, if a single mistake from a single person is enough to cause a large problem, this is a wider system problem and the responsibility of management.Assuming none of these are the problem and returning to code reviews, code reviews are about a lot more than finding bugs. For example, it is knowledge sharing, ensuring code style is consistent, ensuring unit tests are done and documentation is up to date. The best code reviews are two way discussions between the reviewers and authors and are soon reciprocated with the reviewers code. If the developers enjoy it and get value out of it, blame will not occur. The responsibility for quality code rests with the team and not Xyz.