HOW TO WRITE CLEAN CODE⠀
HOW TO WRITE CLEAN CODE⠀
⠀
"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 and impressive poetry!⠀
⠀
Use meaningful names⠀
Meaningful names are descriptive enough that other people 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 we try to write readable code, sometimes you should insert some comments into your code to explain the why and make your code more clarified.⠀
⠀
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 try to improve it.⠀
⠀
What do you do to make your code clean?⠀
⠀
Share your experience!⠀
We’d love to hear from you!⠀
⠀
⠀
⠀
"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 and impressive poetry!⠀
⠀
Use meaningful names⠀
Meaningful names are descriptive enough that other people 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 we try to write readable code, sometimes you should insert some comments into your code to explain the why and make your code more clarified.⠀
⠀
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 try to improve it.⠀
⠀
What do you do to make your code clean?⠀
⠀
Share your experience!⠀
We’d love to hear from you!⠀
⠀
⠀
Comments
Post a Comment