How to quickly master and expand when taking over a new project

https://blog.csdn.net/wantgoworld/article/details/695633 Original text

 

How to read project code

 

When we learn program coding, we will first look at some program code examples, and then learn the examples to modify and write the code; when we first enter a company, the company will assign us the projects to be maintained and modified, and let us modify and maintain, if we want to modify To write, we must first understand the main program of the project; when we look at some excellent open source projects and want to learn the design ideas of these projects, we also need to look at the project code... and so on, it can be said that reading code is for writing code , write very good code. Therefore, for program developers, reading project code quickly is a must-have ability. Some time ago, I took over a system made by a java applet. The company asked me to refer to this project and make a new demo. When reading this system code, I accumulated some experience about reading the project code. The main content is as follows.
Clear the main function and think about how to realize it. First of all, it is necessary to know the main function of the project and what it is mainly used for, and then it is possible to grasp the project as a whole. You can quickly obtain the main functions of the project by consulting colleagues or others in the company, or consulting the project requirements analysis document and the outline design document. If you do not have these documents, you can search the function of the project on the Internet. If none of the above conditions are met, then only Run this project and get the main functions of the project through your own actual operation. After knowing the main functions of the project, first think about it, if I want to do it, how should I implement it, so that I can get the technical difficulties for myself, I will pay more attention to these contents when reading the source code, and the efficiency will be improved. .
Run the project to find the code that implements the main functions. After you know the main functions, you can read the code that implements the main functions. Of course, you need to find out which files and classes these functions are implemented in. In order to find the implementation class, we have to run the project, and find the implementation class code through different methods according to the project type and characteristics. Record these files, then just focus on the code in these files, and you're done.
Understand the project architecture according to the class hierarchy of the code. Export the class diagram of these codes through other tools, such as (rational rose or reverse engineering of powerdesigner), and if it is a Java project, you can also export Javadoc. According to the exported content, understand the general function of each main implementation class and the relationship between these classes, so that the class hierarchy of the project, that is, the project architecture, is clear.
Know the main implementation technology of the project based on the derived class diagram and the doubts about the project. If it is technical, for example, you do not know or do not know how to implement a certain function, then quickly refer to the source code to find the main implementation technology of the project. If you are unfamiliar with this technology, just do a quick search on Baidu or Google, ok, there will definitely be a lot of information about this technology waiting for you to read, hurry up and read these materials to master the content of this technology as soon as possible.
After debugging the main implementation class, understanding the implementation details, understanding the project's architecture, and clearing the main implementation technologies of the project, the next step is to look at the implementation details. Looking at the implementation details, it is also from the whole to the part, starting from looking at each method declaration, and gradually looking at each method body. Of course, it is not necessary to look at each method line by line, just focus on the core methods that implement such main functions. If you are still confused after reading one or two edits of some code, it doesn't matter, just debug it and see what it does after all. There are many debugging methods, and the ultimate goal is to trace step by step, but it is difficult to do this in code written in some languages, such as (javascript or applet), then output some important variables. After understanding the main method of the main function code, we can basically say that we have understood the code of the project and grasped the overall structure of the project.
Modify the code to meet your needs After understanding the project code, the last step is to modify the project code according to your needs, so that we can meet our needs.
The above is the summary of what I am looking at the project code. Of course, if the project has very few functions and no complex technology is used, it can be skipped if you understand the architecture and the main implementation technology of the project. According to the actual situation, you need to go directly to the source. The code will do just fine. If the above content is useful to you, I will be very happy, good luck!

-------------------------------------------------- -------------------------------------
https://blog.csdn.net/wantgoworld/article /details/695633 Original address

Don't talk nonsense, let me copy his words first and then explain

When we learn program coding, we will first look at some program code examples, and then learn the examples to modify and write the code; when we first enter a company, the company will assign us the projects to be maintained and modified, and let us modify and maintain, if we want to modify To write, we must first understand the main program of the project; when we look at some excellent open source projects and want to learn the design ideas of these projects, we also need to look at the project code... and so on, it can be said that reading code is for writing code , write very good code. Therefore, for program developers, reading project code quickly is a must-have ability. Some time ago, I took over a system made by a java applet. The company asked me to refer to this project and make a new demo. When reading this system code, I accumulated some experience about reading the project code. The main content is as follows.

Clear the main function and think about how to realize it. First of all, it is necessary to know the main function of the project and what it is mainly used for, and then it is possible to grasp the project as a whole. You can quickly obtain the main functions of the project by consulting colleagues or others in the company, or consulting the project requirements analysis document and the outline design document. If you do not have these documents, you can search the function of the project on the Internet. If none of the above conditions are met, then only Run this project and get the main functions of the project through your own actual operation. After knowing the main functions of the project, first think about it, if I want to do it, how should I implement it, so that I can get the technical difficulties for myself, I will pay more attention to these contents when reading the source code, and the efficiency will be improved. .

Run the project to find the code that implements the main functions. After you know the main functions, you can read the code that implements the main functions. Of course, you need to find out which files and classes these functions are implemented in. In order to find the implementation class, we have to run the project, and find the implementation class code through different methods according to the project type and characteristics. Record these files, then just focus on the code in these files, and you're done.

Understand the project architecture according to the class hierarchy of the code. Export the class diagram of these codes through other tools, such as (rational rose or reverse engineering of powerdesigner), and if it is a Java project, you can also export Javadoc. According to the exported content, understand the general function of each main implementation class and the relationship between these classes, so that the class hierarchy of the project, that is, the project architecture, is clear.

Know the main implementation technology of the project based on the derived class diagram and the doubts about the project. If it is technical, for example, you do not know or do not know how to implement a certain function, then quickly refer to the source code to find the main implementation technology of the project. If you are unfamiliar with this technology, just do a quick search on Baidu or Google, ok, there will definitely be a lot of information about this technology waiting for you to read, hurry up and read these materials to master the content of this technology as soon as possible.

After debugging the main implementation class, understanding the implementation details, understanding the project's architecture, and clearing the main implementation technology of the project, the next step is to look at the implementation details. Looking at the implementation details, it is also from the whole to the part, starting from looking at each method declaration, and gradually looking at each method body. Of course, it is not necessary to look at each method line by line, just focus on the core methods that implement such main functions. If you are still confused after reading one or two edits of some code, it doesn't matter, just debug it and see what it does after all. There are many debugging methods, and the ultimate goal is to trace step by step, but it is difficult to do this in code written in some languages, such as (javascript or applet), then output some important variables. After understanding the main method of the main function code, we can basically say that we have understood the code of the project and grasped the overall structure of the project.

Modify the code to meet your needs After understanding the project code, the last step is to modify the project code according to your needs, so that we can meet our needs.

The above is the summary of what I am looking at the project code. Of course, if the project has very few functions and no complex technology is used, it can be skipped if you understand the architecture and the main implementation technology of the project. According to the actual situation, you need to go directly to the source. The code will do just fine. If the above content is useful to you, I will be very happy, good luck!

--------------------------------------------------------Boundary-- -------------------------------------------------- --------------------

Because I also have a new project under my hand, and there are also many functions that have not been implemented before (I am also a novice below). So everyone is white, I'm not afraid, and you don't need to be afraid. Here is my summary

1. Look at the xml to find the main APP entry. After finding it, another thing you need to know is the main function of this project.

2. Find the goal. Your goal is to see what you cannot achieve. That is, the places in the whole project where you can't complete or have problems.

3. Debug, debug the code to find the jump direction and jump point, and record the places you really don't understand. More detailed DEbug or comment out and look at the project (not applicable to all projects)

4. You don’t need to explain and parse it out sentence by sentence (time is rich) or know the function of this function (the work is tight), but you must go back and understand it thoroughly, you can’t remember it is the approximate, not the meaning.

Note: If you are very novice, just create a new project and use an empty project to compare the code with this project to see those uses (don’t be afraid that the more things you don’t know, the better the project will improve you after you understand it thoroughly. The bigger, especially in this era of rapid progress, there will be no unused things, as long as you keep learning). Start from the build to see the addition of dependencies and import them step by step, and check where the code of this dependency package is applicable. You have to remember it and then search on Baidu to see if you have a clear understanding of yourself. This is a very stupid method. If you have the opportunity to ask, it is very simple to ask. Find some code people to give you a document to understand what the project uses and what to do, and then fix the unclear places and codes. The founders connect it perfectly

Having said so much, it is nothing more than receiving the project ---- checking the content of the project ---- finding the problem (knowledge points that you don't know) ---- understanding and digesting (knowledge points, it is best to write a small demo test) - --Extension (increase the content of the project)---Complete---Don't forget to review the knowledge points (don't forget to search for useless work later)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324937790&siteId=291194637