Bad code. Let’s get this scenario: you’re a junior developer, joining a new fresh and big project. And then you instantly face the same problem that every developer faces sooner or later: other developer’s lines of code. That ugly, unreadable thing, poorly write, untested and so on. Those lines are a nightmare and surely you could do that better!

It brings up questions like “What does this line of code?“, “Why is this variable named like that?” (naming is still one of the biggest problems of a DEV) and so on.

That would be a normal scenario reaction, of course. But let’s breath, stop cursing and try take a closer look into so called “bad code” issue.

I’ll try to be on point about it because this problem is kinda sensitive around developers and I just started writing so I gotta be friendly. So I give you this piece of advice when you face the “other guy’s lines of code” – don’t judge it.

Yes, you heard that right. In my opinion, there are various reasons that sit behind so called bad code. And judging isn’t valuable to you or to your environment, so try skip that part. Here’s a slim list of reasons that could lead to bad coding:

1. Deadlines

Everybody hates deadlines! The world would be a better place if there wouldn’t be any deadlines – but they exist, and even worse, they represent the most important thing not only for a project, but also for business.

They also transform developers into some kind of robots and make them lose focus sometimes. That could easily lead to some kind of “quick fixes” in codes, because the pressure is high and the project needs to be delivered. Maybe you have the “politically correct” solution for the code, but that could take you maybe extra hours, and when it comes to deadlines, “I need more time to fix this” is not an option. So bad code appears.

2. Burning Bugs

Launch date is so close for project, hard work been involved, extra hours and all that. But right then, the enemy appears from nowhere: a bug.

That leads also into a quick fix problem, because time is limited and there’s no other way to fix it quickly. Bad code appears again, but at least the bug is gone and everybody’s happy. Until next time, bug. Because we all know there will be a next time.

3. Developers lack of inspiration

Well, everybody could have a bad day at work. No matter the reason, it just happens. You may not be in the mood for writing code, or the vibe ain’t right, or the environment affects you in a negative way. These could lead into so called lack of inspiration.

You face a problem, and your brain seeks for solution. The easiest one came affront and you won’t spend more time into finding another one, or a better one. You just use what you know, without thinking on long term. Bad code appears.

Conclusion

These are just a few of reasons that could lead to bad lines of code. In fact, every bad code have its own story. And if you rush into judgment without knowing the story ain’t the right thing to do.

Try empathize a bit with the poor DEV that wrote that ugly function, or named that shitty variable some time ago. Maybe it had its reasons to do it so. Everything is contextual when it comes to coding, and its decisions were the best thing to do at that moment.

So let’s stop complaining about other people’s code, because we’re not that perfect either. Simply skip the curse part, move on and find a better solution without judging that hard. We all make mistakes.

Leave a Reply

Your email address will not be published. Required fields are marked *