Two days ago, I had dinner with an old programmer with 8 years of working experience in python, and then he shared with me several Tips of GitHub open source projects. Later, after consulting the information on the Internet, I compiled this article. In this paper, including
- 1. Accurate search on open source projects
- 2. Skills for online reading of open source projects on github
- 3. Suggestions on how to track the dynamic trends of popular github projects
- 4. Suggestions on how to read the source code of the github project
- 5. Suggestions on how to contribute to github open source projects
1. Accurate search on open source projects
Regarding the precise search of open source projects, through more detailed search conditions, we can find our
“心仪”project source code more accurately . The following is a summary of the usage:
|Search for warehouses whose warehouse name contains "xx"|
|Search for warehouses whose warehouse description contains "xx"|
|Search warehouses whose readme file contains "xx"|
|Search warehouses whose fork/star number is greater than or equal to 3000 and are related to "xx"|
|Search warehouses whose disk space is greater than or equal to 5000kB=5MB and are related to "xx"|
|Search for warehouses that are updated after 2019-01-03 and are related to "xx"|
|Search warehouses that use apache-2.0 protocol and are related to "xx"|
|Search warehouses that use java programming language and are related to "xx"|
|Search for warehouses whose user name is joshlong and related to "xx"|
2. Skills for online reading of open source projects on github
Just add "1s" after the domain name of the warehouse you want to read online to open the door to a new world with one click:
3. Suggestions on how to track the dynamic trends of popular github projects
Here is a near-perfect GitHub Chinese ranking list. Here, all excellent high-scoring projects are available and ranked! About this project, the author is kon9chunkit, GitHub Chinese ranking list, to help you discover high-scoring excellent Chinese projects, and more efficiently absorb the outstanding experience of Chinese people; the list is updated once a week, so stay tuned!
Recommend ヽ(•ω•.)ノ for tracking high-quality github open source projects, look down↓.
|Site name and link||Related introduction|
|GitHub Trending||It comes from the official project trend list of GitHub. Some projects with faster growth in Star will appear here. Developers can filter for different programming languages, which is a good channel for mining high-quality projects.|
|GitHub Topic||GitHub is slowly optimizing the information classification of projects, so that some high-quality open source projects can be pushed more specifically. In the early days, most developers learned about some open source projects from Trending or the dynamics of people they followed. However, such exposure is obviously not friendly to a newly launched open source project. Therefore, GitHub should launch some more abundant channels in the future. Let everyone better explore some high-quality open source projects.|
|Hack News||A website often visited by technical people, created by the famous YC founder Paul Graham, is also the origin of many high-quality open source projects. Many developers will recommend their open source projects from time to time. Maybe an open source project you are currently using may have been known through this channel from the beginning, and then slowly developed and grown.|
|Changelog||This channel may know relatively few people, but the quality is very high. Many open source projects have appeared here when they are unknown. I have subscribed to the nightly email of Changelog for many years, and sometimes I have nothing to do. I will go and look at them one by one.|
|It is inevitable to talk about the hodgepodge website of Reddit. The opensource theme above also has many excellent open source projects. However, because of the many themes on Reddit, it is not a vertical website for developers, so the frequency of updates will be lower.|
|Git Hunt||An open source Chrome plug-in that turns your Chrome Tab page into a recommendation page for GitHub open source projects. I am a heavy user of this plug-in. I have installed this plug-in for several years and have never uninstalled it. I think I am one of the browser plug-ins that developers must install. One. Sometimes when using Chrome to search things, ⌘+T often gives me unexpected surprises.|
4. Suggestions on how to read the source code of the github project
Tips-1:Write a comment
Writing comments is the most important step in reading code. Generally speaking, the source code we read is a system that we are not familiar with. There are generally several problems with reading other people's code:
The core idea of writing annotations is as follows:
- Guess to write, Just start reading a code, it's hard to determine once all the functions, a method might guess to write notes, Write a rough comment based on the name and location of the function. With a deep understanding of the project source code, continue to adjust the comment.
- Write more detailed comments in the core code segment, There are some functions or classes that play a key role in the program, so you must write more detailed annotations. This will greatly help you understand the code.
Tips-2:Learn to read repeatedly
- There is no one who can read all the codes at once. At least I haven't encountered it yet. Reading the same piece of code over and over is helpful to understand the code. Generally
在第一次阅读代码的时候 你可以跳过很多一时不明白的代码段，只写一些简单的注解，在以后的重复阅读过程用，你对代码的理解会比上一次理解的更深刻，这样你可以修改那些注解错误的地方和上一次没有理解的对方speaking, . Generally speaking, you can basically understand the meaning and function of the code after reading it 3 or 4 times.
Tips—3:Run and modify the code
- If your code is runnable, let it run first, and use a single-step tracking method to read the code, which will increase the speed of your code. The code understands the meaning of the code by looking at the intermediate variables, and it will provide great help for future modifications. Regarding how to debug with breakpoints, please refer to this blog post: A summary of the most practical debugging techniques in the entire network , and this blog post: Pycharm Tutorial-Breakpoint Debugging .
- Replace the original code with your own code to verify your guess, but keep the source code before. A function of 600 lines is difficult to read. It is not a good habit for programmers. When reading this code, the code was modified and turned into 14 functions (each about 40-50 lines).
5. Suggestions on how to contribute to github open source projects
How to find the project you want to contribute?
When facing open source projects, first correct your attitude.
To participate in open source, you must be the one who can find or solve problems. Find the project you are interested in, start with small things, fix invalid links and typos in the document, participate in open source, find the problem and elaborate, and reproduce the problem is also involved in open source.
28% contributed work
When you are like this ->
then,Continue to maintain the spirit of the previous, plus "do not repeat the wheel, so try to use the code written by the open source community", write more code, you should be able to become an excellent contributor.
In addition, you can find open source projects that interest you through the following channels.
- GitHub Explore
- Open Source Friday
- First Timers Only
- 24 Pull Requests
- Up For Grabs
- First Contributions
How to submit a contribution?
For more efficient communication and cooperation, please ensure that when you ask questions or submit PRs, you do the following:
After doing the above points, you also need to search the project issue, README, stackoverflow and other channels to ensure that the problem is not fixed by others. It is best to submit contributions in the following ways:
GitHub issue - 发起提问，进行讨论
GitHub pull request - 提交解决方案
其它渠道 - Stack Overflow、IRC、Slack
When asking questions, in order to reduce the time for communication between the two parties, please use the most efficient and direct questioning method. Recommended reading: click here -> reference link: the wisdom of asking questions
After you contribute
Everyone feels nervous when they participate in the contribution at the beginning. Generally, after you participate in the contribution, the following situations will occur:
First, make sure that you check ahead of a variety of the project, specifically to see the checklist .
If everything is normal, you can try to contact the relevant project personnel in a week to ask about the specific situation.
After you get the relevant notice, out of polite and efficient communication, please give feedback in time. Because others may spend a lot of time reviewing your question/code, and then initiate a change submission.
If you do not have time to process the changes submitted by others, please also inform the submitter and the project maintainer in advance to find someone who can take over and deal with the problem.
This situation is normal, and the general author will also explain the specific reasons for not being accepted. If not, you can ask the author for the specific reason under the relevant discussion thread of the project.
Congratulations, your contribution really helped others.I hope that I will stick to it later. Remember, a journey of a thousand miles begins with a single step.