Who is that horrid little developer?
We all write bad code! Think you don’t, then just look at your GitHub logs from two months ago. I mean really what were you thinking? But something it goes a little further than that and you when you show it, everyone sits back and says ‘What, really’.
Here is an (extremely bad) example:
Things.do_thing! if rand(10) == 0
Disclaminer: I did NOT write this code, but it is live on a production application.
I think the important thing here is not around this being terrible code, but to recognise that we all write terrible code.
Sure this is worst than most, but unless we can talk with the developer we can’t really understand the context or reasoning behind the code, and we can never really understand why it was written. That is not to justify the above code, but instead, point out that understand that under the right circumstances and with the correct pressure than anyone of us could be the author.
So blame/solution time right. Well, that is easy, review your own code like you would others and get others to review your code if you can. Understand that mistakes happen, that you have made mistakes in the past and are if you in the middle of writing code are most likely making a mistake right now. Don’t blame others for the code they have written in the past, focus on understanding the reason the code was written.
And finally, it might have been you, so either learn from your mistakes, or help others learn from theirs, but never blame someone for trying. :)