I am amazed at how often I see or hear a programmer say “This code is crap.” You’ve probably said it. I admit I’ve said it. I hear or read it all the time, and it always pulls me back a little. It’s just so definitive and ultimate. A judgement from the heavens. It breaks programming down into an unhealthy binary where the code is either good (and therefore to be accepted as good and infallible) or it’s bad, and we all can agree that the best thing to do would be rewrite the entire thing.
Yes, I understand that writing code to be read by other people is a standard that we all say we should do, and yet we never do. It’s hard to do, perhaps because it’s not really well defined what ‘easy to read code’ is. Whatever the case, the code makes sense to us in the moment so we move on. Maybe it’s a system or a file that we are going to be the primary authors on, and so it doesn’t really matter how easy or hard it is for anyone else to read. I understand it, and no one else reads it, and I’m not planning on going anywhere, so we’re good.
One of the skills I’ve worked to build up over my life is that of empathy. It’s defined as the ability to understand and share the feelings of another, but that also feeds into how another person thinks about things too. I’m not saying I want to justify other people in my head. But if someone bumps into me on the street and doesn’t apologize, and I’m feeling a rush of anger flow to my head, if I step back and think hard, I can probably remember a time when I was in a massive rush and bumped into someone too. Maybe I didn’t apologize either. So maybe they have, in their minds, a legitimate excuse for behaving the way they did.
The programmer who wrote the code I’m reading may have been lazy or not very experienced. That’s definitely possible. But odds are they are quite similar to me – someone who works hard and is looking to improve, but clearly has areas to improve upon. Maybe they had a time limit on what they wrote. Maybe they were unfamiliar with the problem and this is the first time they’ve ever tried to solve it. I have some projects from school that were pretty rough myself, and I know I’ve checked in code that could have used a little more time, but I just didn’t have it to afford at that moment.
I wish programmers would, in this one instance, step away from the binary and get a little more personal. Declaring that a code base, language, or idea is “stupid” hurts the industry as a whole. It scares away newcomers who are just trying to feel their way blindly through the masses of computer engineering. They’re like children learning to walk and we’re putting up brick walls that smack them in the face when we pass such hard judgement. Instead, I wish programmers could be a little more empathetic. I have yet to meet a programmer who is truly malicious and is trying to trick other programmers who read their code or use their products. The International Obfuscated C Code Contest can be hard as hell to follow, but that’s a puzzle to enjoy, not a demon to avoid. Rather than passing judgement, I’d love to see more conversation. I don’t think C++ is a good first language to learn, but I’ve never had a deep conversation about it with anyone. I’d love to see a discussion, but I haven’t found a platform online yet where I feel that discussion could happen without name calling coming into play early on. But I’m happy with what is happening with the Handmade Dev community, and once the site launches, I’d love to see it become a place where discussions like this can happen.
On a sidenote, I will be speaking with the founder of Handmade Dev, Abner Coimbre, live on Saturday, Feb 13 at 5PM EST. It will be broadcast on Twitch and then hosted on Vimeo. Here are the relevant links: