HOW TO WRITE CLEAN CODE:

đź§µA THREADđź§µ

Don't call the world dirty because you forgot to clean your glasses!

👇
WRITE FOR HUMANS:

The code we write will be interpreted by machines. However, it will be read and improved by humans. So, write beautiful, impressive and readable code.
USE MEANINGFUL NAMES:

Meaningful names are descriptive enough that other developers will be able to understand the purpose of the variable, function or object.
ONE TASK AT A FUNCTION:

Let every function (or method) perform just one task. This will make your functions smaller, and increase your focus on implementing that specific feature and the ability to debug that function.
USE COMMENTS WHEN NEEDED:

No matter how hard you try to write readable code, sometimes you should insert some comments into your code to explain the why and make your code more understandable.
CONSISTENCY IS KEY:

Pick a set of coding practices and then stick to those practices in all of your projects. It will be much easier to return to your older code and continue where you left off. Indentation, naming style, file structuring etc.
REVIEW YOUR CODE:

When you write code, if you want to keep it in the best shape you need to update it regularly. You should review it on a regular basis, clean it up and improve it.
In the end, it seems like a bit overwhelming in the start but take one step at a time. Get comfortable with it and take the next one. Use a progressive approach to build the habit of writing cleaner code.
You can follow @thearslankhalid.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.