So what good habits have I adhered to?
Read more excellent codes.
Look at some excellent open source framework codes when you have time. You don't need to study them thoroughly, as long as you can learn some excellent design concepts. You can view the source code by debugging at breakpoints.
Read more official documents, it must be the most accurate and real-time information. People who write official documents are usually the developers of these technologies or software. They know these things best, so the documents written are not only of very high quality, but also of the latest content.
Normative naming
ITWorld once launched a poll of "the biggest headache for programmers". As a result, nearly half of programmers think naming is the biggest headache. Some people give up on themselves when writing code, using names that only they can understand, and some people don't understand at first glance.
Naming of functions, variables, class names, etc. Should have its own meaning. Both internal variables and global variables should form their own naming rules, and the meaning of variables can be understood at a glance. Good naming can greatly improve the readability and maintainability of the code.
Annotate carefully
Like naming, there are two things that make programmers have a headache: writing comments and whether others read them or not. The purpose of writing a comment is to let you know what you are writing next time you see it. You may not even know what you are writing when you see your code again, let alone how others feel after reading your code.
Write notes where necessary, so that the people who take over can understand the code and make it convenient for themselves, but the notes should be accurate rather than numerous.
Modular programming
Modularizing the code and extracting the common logic can make the structure of the code clearer and facilitate the location when bugs appear.
Code nesting is something we often do. Although there is nothing wrong with nesting itself, it sometimes makes the code more difficult to read.
In order to avoid unnecessary nesting, we can use the "return early" design pattern, which allows us to use the if statement as a protection clause to check the error and return before executing the next code.
The good habit of programming should really be developed from the beginning, even if it is not open source code, we should take it seriously and develop the good habit of programming in the process of continuous practice.