Other People's Code
TL;DR We are all continually improving. Don’t forget that.
Recently I’ve been hearing more and more developers say stuff like “Wow, what was this person thinking when they wrote this?” or “Really? Sigh…..”. Don’t get me wrong. I’ve been guilty of this also. I am writing this post to remind myself and other developers that if you could, you would say those things to yourself of six months ago or even yesterday. We are all continually improving and we started writing bad, inexperienced code just like some of the code your reading now. I also saw someone say “Bad code doesn’t immediately become bad; it happens over time, gradually.” (thanks Sharon) That is true.
I like the quote:
Write code as if the person who will maintain it is a psychopath and he/she knows where you live
I’ve also told developers recently that I read more code than I write. Yeah, maybe some of you just churn it out like you exhale but that isn’t me. That doesn’t mean I don’t produce, but I actually read code for fun. I am always reviewing code for work and side jobs, but I’m also reading open source library code for projects that I use or plan to use so that I can understand how they work and also to learn. Some people read books or newspaper articles. I read source code.
I am absolutely not passing judgment on anyone. There is a fine line between ignorance and lack of intelligence. Ignorance means the person is unaware/hasn’t been taught/etc. Lack of intelligence means that no matter how many times that person is taught they will never grasp the subject. This includes multiple ways of teaching the same subject matter. When you read those developer’s code, you will sigh. But…you should still add comments to their code and end it with something like “wdyt?” (wdyt == what do you think?). You present them with your perspective but aren’t forcing it on them. Maybe someday it will click. Maybe not. That’s not up to you. If they are destructive to the code, then that is a subject for another post. :)