7

If I am assigned a bug, I sometimes check version control to see when it was introduced. Should I notify the developer that introduced the bug, even if I already fixed it? The advantage is that it could help learning but the disadvantage is it could seem like criticism

closed as primarily opinion-based by user40980, Robert Harvey, Ixrec, gnat, user22815 Jan 21 '16 at 17:22

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Not necessarily. Software development is a team sport, and if you have tools like a bug tracker and source control (which you should), your colleague can look up the bugs he caused, if he cares to know. – Robert Harvey Jan 21 '16 at 1:31
  • I never heard of a tool that could do that. It does not even seem possible to automate such analysis. Could you explain what you mean? – JoelFan Jan 21 '16 at 2:15
  • I'm not referring to automated analysis. – Robert Harvey Jan 21 '16 at 2:28
  • 1
    You said I don't need to tell him because he can "look up the bugs he caused". If there is no automated way to find "the bugs he caused", how can he "look them up if he cares to know" without anyone telling him? – JoelFan Jan 21 '16 at 13:17
  • 2
    He means that your company must have a bug tracking software. Report it there and forget about it. – Leonardo Herrera Jan 21 '16 at 14:19
18

If it's part of your process, then yes. If it's specifically not part of your process, then no.

If it's not specified, the best thing is to ask the developers if they would like you to notify them if you fix bugs in their code and to respect their individual wishes.

If you don't want to do that or it's too complicated, you can let them know that you found a bug. If you think that they will feel criticized, you can pitch it as "I fixed this thing that you had worked on before, and I am now appealing to your prior knowledge to make sure that I have considered all the subtleties in doing so." In other words, you're not saying their code was screwed up, but that you respect that their deeply-thought solution might be more complex than your own superficial understanding, and you want their expert consideration for the repair work you undertook. This has the advantage of making sure that they are aware of the code defect (and subsequent learning opportunity) without being affronted.

  • 2
    A commendation for asking them to check over your change, making sure you didn't break anything you are not (yet) aware of. – Deduplicator Jan 21 '16 at 2:56
6

I think, if you found a bug in some developer's area, the best course of action would be to ask that developer to code review your changes.

This way you are not hurting somebody's ego, you are just doing your job (fixing a bug assigned to you, and making sure you don't break more as a result of the 'fix').

Build a conversation in these terms.

  • I am assigned to work on Problem X (don't mention it's a bug).
  • I analyzed the code and I see that the best solution for it is to modify code in the Area Y, which you own.
  • Can you, please, review my solution that I didn't break something I don't know.

From experience, people react much better if you ask their opinion proactively, than by finding out your changes in their code.

2

At the very least, you should notify them that you have discovered a potential bug with their code. This could be considered criticism (and you must be certainly be constructive when criticizing); but there is also potential that what you have found is not actually a bug.

By notifying the responsible party, you aren't just assigning blame. You are also giving the author an opportunity to defend his actions. It may well be that the "bug" was an intended (or discovered) feature that is relied upon by your users. It is also very possible that, even in the case of a real bug discovered, your solution overlooks corner cases that the code's author is more familiar with.

By notifying a bug's author, you also give them the opportunity to rectify any other similar mistakes they may have made. If they have made a mistake in one place, it is likely that they may have made a similar mistake in others.

-1

Just make sure it is constructive criticism, and tell him how you fixed the bug, so he doesn't make the bug again.

  • That has happened to me three or four times throughout my 30 year programming career. In each case I have worked with the fixer make sure the fix did not break something else. The goal is to produce excellent code and none of us is perfect. – kiwiron Jan 21 '16 at 7:14
-3

Are you the maintainer of the code? If so fix the bug, document the fix, and don't go pointing fingers to who's "to blame" for it in the first place.
Is someone else the maintainer? What were you doing digging through their code in the first place? Notify them that you found a potential problem and where it's located. Maybe give them hints on how to fix it if you've got some. Don't go pointing fingers and laying blame for the problem.

Did you have no business digging into that code? Shame on you, you were wasting your time doing things that aren't your responsibility and might even be in violation of workplace policies regarding access to documents that aren't required for you to do your job.

Way you wrote your question, you seem to just want to gloat to the people who "made the bug". Which is quite often not even the case. Code changes, something that's correct at some point may not be correct later after code somewhere else changes, causing problems with the input of that original code which causes it to misbehave.

  • 2
    Please reread the first 6 words of my question – JoelFan Jan 21 '16 at 15:03
  • 3
    I think you misunderstood the question but even then, reading other people's code and finding a bug in it is, by no means, a “shame”. – 5gon12eder Jan 21 '16 at 15:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.