Importance Of Writing Clean Codes.

Importance Of Writing Clean Codes.

As a developer the first thing that strikes our mind is what do I mean by writing clean codes? I would define clean code as the code which when a beginner looks at and says " Hey XYZ your code was very readable and I understood it very clearly", this is where the developer needs appreciation and a pat on the back. There is very slight line of difference between a programmer and the best programmer. The difference between the two is experience and the ability to write clean codes. Let us understand how to write clean codes in simple five steps:-

1. Use Meaningful names of functions ,classes and ID:- It is very important that you maintain the readability of your code. Suppose, When you are making a function to check whether a birthdate is palindrome or not, you shall name it ' checkPalindrome' and not something strange which is not letting the user know what this function is for. 2-Code-Smell-300x215.jpg

2. Proper Use Of Functions:- If there is only one function that performs everything, will it be not irritating to see the code? It will be. We should make our function responsible for single task and see the magic happen, as a coder its not only you who needs to understand the code , the people seeing your code must know what all is written and what is depicts.

5046007.jpg

3. Write Reusable Codes :- Let us understand this with an example, Suppose you need to put your social media links to all the projects, except the design part, the structure would be same in every project, So it will be very time consuming if we create different HTML code for every project for particularly social media links, therefore it is advised to make codes reusable & scalable for increasing efficiency.

images (5).jpg 4. Comments Utilization:- The best part of an intelligent coder is that he/she need not explain his/her code to anyone rather they get it by their own. It is always better to use minimal comments to point the most important part of your code. Comments must act as a moderator to help the reader rather than a messy stuff written to confuse the reader.

write-clean-simple-code-with-helpful-comments-and-no-unnecessary-61559381.png 5. Formatting Code and Proper Indentation:- Unwanted spaces and wrong indentation may make your code look ugly, its very important to beautify your code with the help of extensions if not manually(take for example beautify extension in VS code).

wk843smkri441.jpg

I would like to end this blog by giving you a situation. Suppose you are an employer of a startup, you have two candidates lined up for a role of a frontend developer. First one: He has good knowledge of coding and has experience of some years too. Second One: He has good knowledge of coding alongside he has very well structured that is clean code written with proper commit messages, and has experience of some years too.

Question for you, Whom would you give chance? We all know who it must be.

Hope you liked this blog, Do let me know in comment about it.