Why does code have to be clean?

Have you ever tried to read someone else’s code? It can be quite an adventure. Weird variable names, functions that don’t explain what they do. Object names that don’t seem to be right. If you’ve ever had this happen to you then you know why code has to be clean. If this has ever happened while you are viewing your own code, after some time, then you definitely know why code has to be clean.

Who needs clean code

As long as you follow the rules of the language you’re using, the compiler doesn’t care if your code is clean or not. It’s just going to process it and make something the computer can work with. The computer doesn’t care about your variable names, all it wants is ones and zeroes.

Code has to be clean because it needs to be understood by humans. It needs to be understood while it’s being written. It most certainly needs to be understood when it’s being modified. Any piece of software that does it’s job well, will be modified because the users now want it to do more things. Don’t you want your code to be easy to modify?

Where can we learn?

If you want to learn how to write clean code then I suggest you start following Robert C. Martin or “Uncle Bob” as he refers to himself. You can find him at Clean Coders or buy his book Clean Code and start improving your skills. Rest assured that you will notice your code start to improve very quickly.

I will write down my thoughts in this blog as I study his book and videos. I will also try to share how my coding style has changed for the better.

Stay tuned!

Leave a Reply