Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How many of the top programming habits do you have to develop to become top programmers?


Jun 02, 2021 Article blog



Good programming habits are critical to improving our programming capabilities.

It's not bragging Oh, even these habits are more practical than learning two more chapters of knowledge than you do!

Because good programming habits mean you can put less effort into it: time and effort to produce cleaner, cleaner, smarter code.

 How many of the top programming habits do you have to develop to become top programmers?1

What are some good habits in programming that are worth sticking to from the start?

Here are 6 good programming habits for good programmers to share with you at www.w3cschool.

1, comments.

Some programmers often do this, and their code comments are unclear or do not write comments.

The next embarrassing thing happened when he couldn't read the code he had written three months earlier. If hundreds and thousands of lines don't write comments, it's too much trouble to maintain!

 How many of the top programming habits do you have to develop to become top programmers?2

2, if statement must be with braces

In the code you hit, the if statement must have braces, even if there is only one statement. Why is that?

Rough look, with no curly braces, but this small detail in the maintenance of careless can easily go wrong.

3, the appropriate use of spaces

We know that spaces basically don't make much sense to the compiler. However, it is important in terms of the readability of the code.

 How many of the top programming habits do you have to develop to become top programmers?3

4, modular.

The common logic of this extraction is to extract, do not copy paste, because it is easy to appear bugs.

 How many of the top programming habits do you have to develop to become top programmers?4

5, indentation

Every new while, for, if statement, switch structure needs to be indented. The indentation of the specification makes the code legible, and every programmer needs to have that bit of code cleansing to be able to do so.

6, the last one, w3cschool shares one of the programming habits summarized by foreign programmer Al Katib.

That is, when using loops and conditional statements, the left and right brackets are corresponded to before other statements are written inside. That is:

code:

1 for(int i=0; i <10; i++)

2 {

4 printf(“i=%dn”,i);

3 }

Here, the numbers at the beginning of each line indicate the order in which the loop code is written.