Try to Write Code not Garbage

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”

By "Martin Fowler"

Hello,

Today We will talk about a serious issue that I recently faced and I thought I should share it with you. As a programmer, You will collaborate with other developers to work on any kind of project, you will see this issue.

Programmers in the world:

The problem is there are many programmers out there but there are few good programmers in the world. Very few of them are good at their skillset.

What is Readable Code?

The issue that I want to share with you is writing code effectively. Readable code is code that other developers can understand easily. You will see some piece of code that is very hard to understand not because you are weak in programming but because the code is not written to understand, it was just written to run in the first place. The programmer just wrote the code to make it work but & he/she doesn't give a shit about the readability of the code.

Before writing this article, I was working on a project where I had to implement some features. Another programmer had worked on this project before & before adding features to it, I had to read the code of the whole project before changing anything in it because I had difficulty in understanding the code. The code was too messy & was not organized well. So I thought I would share this with you so that you can learn from it.

What you can do about it?

If you are a newbie in programming, don't stress too much about this issue. You will eventually learn to code effectively. You have to practice daily & see other code of other developers that are good at programming.

You can make your code readable by using a good variable name, functions, loops, OOPS concepts etc.

How to write readable code?

Below are some of the tips you can follow to write readable code.

  1. Use meaningful variables & function name

  2. Consistent use of tabs & spaces

  3. Use comments in your code

  4. Use DRY principle

Clean code is a habit:

One thing to keep in your mind is that writing clean code is a habit & you cannot achieve it in one day or night. It is a habit & you will adopt it by practicing more & more on your skillset. So keep practicing & improving your programming skills.

A book about Clean Code:

If you are more interested in this topic then read the book Clean Code by Robert Cecil Martin. There is a ton of information for you in this book about clean code. Give it a read.

That's it for today. If you like the article, consider giving your valuable feedback so that I can improve it.

Don't forget to share it with your friends.

See you in the next one :-)