Author: trinea
Links: https://www.zhihu.com/question/26343609/answer/32624241
Source: Know
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.
Laxatives. In the Android open source project source code parsing public template @codeKK open source Station to write the analysis steps, here again to introduce their own views:
Here the study is divided into quick master and all project analysis, open source project Android is generally divided into full project (APP) and tool library, the analysis can be summed up as total score:
1 Total----Function understanding
Learn about project features (Sample and documentation) and mainly into a few chunks. Also understand your needs, such as Pulltorefresh's pull-down implementation.
PS: (1) You can think of yourself first if you will be how to achieve this project, perhaps see the source process will find the idea of collision.
(2) If the time is tight, you can first Google some of the project-related documents combined with code to see, to help quickly grasp, but the online analysis of the article is uneven, need to be cautious.
2 points----Detailed design
Here formally began the Code analysis, the analysis process if the brain can't remember, more hands down the main classes, functions and other roles
(1) Entrance
For the complete App, Manifest finds the portal Activity, and for the tool library, it judges the Ingress class from the calling interface. Then step into the IDE.
PS: Generally good open source project specifications are relatively good, classes, functions, variables from the name can understand the role, so if you need to quickly master the principle of the key to see the function can be.
(2) Core class
In the above step in-depth process has been exposed to a number of classes, a general understanding of the main role of each class
3 Total----Overall design
(1) Function flowchart
The above 2-(1) of the process has been a general understanding of the project process, no trouble can simply draw the process and related classes, functions.
such as Retrofit, volley request processing process, android-universal-image-loader picture processing flowchart.
(2) Overall design
The entire library is divided into which modules and the call relationship between the modules.
For example, most picture caches are divided into modules such as Loader and Processer.
4 reviews
At this time from the 3-2-1 (general design, flowchart, detailed design, and so on) reverse order, you can basically understand how the author originally was designed for fast analysis can walk 1-2 (1)-2 (2)-3 (1) steps.
${project Name} source code parsing Author: trinea
This article is for Android Open source project source code parsing in ${project name} part
Project Address: ${project name}, analyzed version: ${commitid}.substring (0, 7), demo address: ${Project Name} demo
Analyst: ${Analyst}, analysis status: Not completed, reviewer: trinea, proofreading Status: not Started
We recommend that you look at the analysis of volley, UIL, Dagger, Event Bus, to understand the extent of the analysis, as well as the similar flowchart and overall design how to do.
Copy one to your project folder and then replace the ${} content with your own item, deleting the line and the above two lines.
1. Function Introduction
Feature description, including features or benefits, etc.
Completion time
Completed in one day
2. Detailed Design 2.1 Class detailed introduction
Class and its main function function, core function flowchart, flowchart can use Google Drawing, Visio, staruml.
class 2.2 diagram
Class diagram, class inheritance, composition diagram, but with the StarUML tool.
Completion time
Depending on the size of the project, currently simple according to the number of project Java files judged, the completion time is roughly: the number of files * 7/10 days, special project specific treatment
3. Flowchart
Main function flowchart such as Retrofit, volley request processing flow, Android-universal-image-loader image processing flowchart can be done using Google Drawing, Visio, staruml and other tools, Other tools recommended: Not all items must be, not required, please feedback in the group first
Completion time
Completed in two days
4. Overall design
The entire library is divided into which modules and the call relationship between the modules. For example, most picture caches are divided into modules such as Loader and Processer. It can be done using tools such as Google Drawing, Visio, STARUML, and other tools recommended. Not all items must be, do not need to first in the group feedback.
Completion time
Completed in two days
5. Talk
The problems of the project, the optimization points and the comparison of similar functions, etc., not all projects must.
Completion time
Completed in two days
6. Modification and Improvement
After completing the above 5 sections, move the module sequence to
2. Detailed design, 2.1 core class feature Introduction, 2.2 Class Diagram, 3. Flowchart, 4. Overall design
Order becomes
2. Overall design, 3. Flowchart, 4. Detailed design, Class 4.1 diagram, 4.2 Core class features
and self-calibration optimization again, confirm the error after the beginning of the article
Analysis Status: Not Completed
Into:
Analysis Status: Completed
This issue of proofreading will be completed by a dedicated buddy, may make some changes to the analysis document, please understand.
Completion time
Completed in two days