Skip to content

Your code is bad… Take care of it

  Refactoring is often not done.

“There is not enough time”. 

“Its not your responsibility”. 

Look. Refactoring can only *help* you. You don’t need to devote hours and hours to it. Just make small changes. And over time your code will improve. And for the most part. Most of us are not writing NEW code. We are maintaining code. (And you probably should not be trying to write MORE code, but that’s another story). And its likely you will be working in the same code base for the duration of your employment, or will eventually be called to return to it.

You’ve probably have heard about the “old adage”:

“Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.” 

Yes, its funny. But let’s be real. We don’t care about anyone but ourselves. So do it for yourself. Later down the line, when you have to return to an old code base you’ve worked on, you won’t hate yourself and rue the day you ever touched a keyboard.

Stop with the gratuitous comments… Sometimes its necessary. But if you need all those comments to understand the code. Your code probably sucks.

Stop this mess.

And also…(if time permits, the code is not too involved, etc.) You are completely empowered to change variable names to make them easier to understand and follow. Really.

And for those of you who can “remember what you’ve done”, wouldn’t it be better if you didn’t have to? So you can free up your mind to remember other things?

Be kind to yourself and give your brain a break. And remember that code is written, not for computers to understand, but for humans.

Image via themandarinplay

Published inOn Coding