At the dinner, old programmers shared with me Tips of several GitHub open source projects

Preface

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 开源项目的精确搜索, github项目源码的在线阅读的技巧, 跟踪github热门项目的趋势动态, and 如何源码阅读and在开源项目中做出贡献的建议。

Insert picture description here

Article Directory


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:

usageExplanation
in:name xxSearch for warehouses whose warehouse name contains "xx"
in:description xxSearch for warehouses whose warehouse description contains "xx"
in:readme xxSearch warehouses whose readme file contains "xx"
fork/stars: >=3000 xxSearch warehouses whose fork/star number is greater than or equal to 3000 and are related to "xx"
size:>=5000 xxSearch warehouses whose disk space is greater than or equal to 5000kB=5MB and are related to "xx"
pushed:>2019-01-03 xxSearch for warehouses that are updated after 2019-01-03 and are related to "xx"
license:apache-2.0 xxSearch warehouses that use apache-2.0 protocol and are related to "xx"
language:java xxSearch warehouses that use java programming language and are related to "xx"
user:joshlong xxSearch for warehouses whose user name is joshlong and related to "xx"

Click here -> Reference link: Do you really know how to efficiently search for open source projects on GitHub?


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:

Insert picture description here


Insert picture description here

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!

Insert picture description here

Click here -> GitHub Chinese ranking

Recommend ヽ(•ω•.)ノ for tracking high-quality github open source projects, look down↓.

Site name and linkRelated introduction
GitHub TrendingIt 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 TopicGitHub 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 NewsA 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.
ChangelogThis 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.
RedditIt 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 HuntAn 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.

Click here -> Reference link: How did I discover high-quality open source projects?


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:

  1. 搞明白别人的编程思想不是一件很容易的事情,即使你知道这段程序的思路的时候也是一样。
  2. 阅读代码的时候代码量一般会比较大,如果不及时写注解往往会造成读明白了后边忘了前边的 现象。
  3. 阅读代码的时候难免会出现理解错误,如果没有及时的写注解很难及时的发现这些错误。
  4. 不写注解有时候你发生你很难确定一个函数你时候阅读过,它的功能是什么,经常会发生重复阅读、理解的现象。

The core idea of ​​writing annotations is as follows:

  1. 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.
  2. 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

  1. 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

  1. 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 .
  2. 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).

Click here -> Reference link: How to effectively read the code of the open source project on Github?


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 ->

“这项目有个地方错误处理没写好,我看看代码...嗯,就是个智障问题,顺手PR一波…”

“这项目怎么连Xxx都不支持…我看看咋整…嗯,做出来了,顺手PR一下…”

“你这项目怎么不开源?不开源就是原罪啊!所有项目都应该AGPLv3!所有人都应该加入FSF,给自由软件打钱”

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.

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:

1)没有得到任何反馈

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.

2)有人更改了你的贡献

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.

3)你的贡献未被接受

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.

4)你的贡献被接受了

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.

Click here -> Reference link: How to be an excellent contributor on GitHub?