Software Development Experience Summary (5) Art of reading source code

Source: Internet
Author: User
Reading the source code is the only way for every developer to grow. An excellent source code is the painstaking achievement of the author's years of development technology. It is a good source code study, it will always improve your technology to a certain extent. Then, reading other people's source code is not a blind view of the Code, but a full understanding of the author's programming ideas, the advantages and disadvantages of the Code, on the basis of understanding the author's ideas, you can write code that is better than the code to achieve the "Transparent" realm. If the following guidelines are observed when you read the source code, the effect will be better.

Criterion 1: the author's Labor achievements must be respected. After reading other people's source code, if we need to get it for use in our own project, we recommend that you specify the code source in detail in the Code (but many Chinese do not pay attention to this point, when I look at the source code of fyireporting, if the author uses other people's code, it must be noted next to the code source, or even the code seen on a webpage, will also write the URL ). If a person who does not respect the fruits of others' work has a problem with his or her character, his or her attitude will not work, and his or her technology and ability will not be greatly improved, those who do not respect the fruits of others' work are despised.

Criterion 2: design the code based on the software's functions, and view the Code with questions before you read the code. This is the most important criterion for looking at the source code. You should first design it based on your own ideas, and then compare it with the author's ideas when looking at the code, in this way, we can find out our own ideas or the shortcomings of the author's code, so that we can analyze and learn from a higher perspective (this is a very important principle, not only to look at the source code, this is also the case for reading books. before reading the code, I will first design a system based on my own ideas, and then compare it with the source code. Usually some codes are considered treasure for the first time, however, after reading it for many times, I think it is not as good as I think, because I can use less code and more concise structure to make software with the same function. In future articles, I will give an example of reading the source code of fyireporting ).

Criterion 3: the code should be easy to difficult. Do not try to eat big fat at one breath. This is also very important. Looking at the code that is too difficult at once will greatly combat your enthusiasm.

Criterion 4: think more about good code, and even have the impulse to print it out. At the beginning, you may not understand the code very well. For some unfamiliar class names and method names, you may know a little bit about them for a long time, but as long as you keep watching it, it is very likely that one day you will suddenly wake up and understand everything. You will suddenly find yourself so great.

Guideline 5: Practice! Practice! Practice! We can see that the code is for better program writing. We need to dare to apply the learned advanced knowledge and advanced technology in practice. Only when we use more, can we fully understand and master it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.