What is the C++ development environment like at Tencent and major manufacturers?

In major technical forums and WeChat groups, programmers often argue over issues such as programming languages ​​and IDE development environments.

I saw a Zhihu question this day:

picture

Below is an answer from a Tencent employee. I would like to share it. I have put the link to the original article at the end of the article.

Briefly introduce the backend development environment of Tencent WeChat Business Group.

The WeChat business group is quite special. It likes to build its own set of things for its own use. Some infrastructure is different from that of other Tencent business groups.

hardware:

Now it's usually a macbook pro+ remote Linux host. In terms of remote hosts, the previous collective development machines have been abandoned. Each person has a relatively independent cloud host. My configuration is 8-core Xeon Gold + 16GB + 500GB. Considering that this machine only runs most of the time, It's an editor with pretty good performance.

software:

Code editing: Old employees usually use vim and have basically never seen emacs. Many new employees have started using vs code. Most people around me use vim, and everyone sometimes shares some plug-ins they use with each other, but everyone's configuration is very different. The editor is one of the main battlegrounds for online programmers to fight, but in reality colleagues have never argued about the editor. Everyone is still very civilized. When newcomers come, we old vim users will also take advantage of them. Learn vim, but people finally chose vs code and we didn’t say anything wrong.

Version control : Basically, everything has been migrated to git. In the past, svn was used. The vim party basically uses git commands directly, and some vs code users use the graphical front end on mac.

Compilation system : It is now based on a set of things developed by bazel. When compiling the code during the development phase, an instruction is used to send the local code diff to the compiler for compilation. This allows many intermediate files to be shared, which is quite fast. In the past, we used to compile on the local development machine. Some relatively large modules took dozens of minutes to compile, and the compilation consumed too much CPU and caused vim to freeze...

Tool chain: I use the GCC set. Since the background services are all microservices, each small module can be built using gcc4 or gcc7. Recently, I wrote a small module using c++17, which was compiled with gcc7. online. I hope clang can be supported one day. I prefer clang’s compilation error message...

A day in the life of WeChat backend development (ideal Orz):

  1. Open mac

  2. Open Outlook and click away all the red dots in your inbox

  3. Cut to item2. At this time, mosh has automatically reconnected to the development machine, and a bunch of tmux windows are already waiting for you.

  4. vim...patchbuild...vim...patchbuild...git

  5. During this period, there are meals, lunch breaks, walks, and paid defecation.

  6. Switch to chrome on mac, open the WeChat change system, bill of lading, compilation, synchronization to the test machine, and grayscale online in one go

  7. Cover your mac and go home from get off work

  8. //Enjoy the nightlife

Some other random thoughts:

WeChat's backend development environment has always had many shortcomings, but it has been improving, and we can see some progress every year. What has not been solved yet but has a greater impact on development efficiency is the semantic analysis tool of the code. At present, the environment in which everyone writes code does not have precise jump and completion capabilities. Considering that everyone's environment is very inconsistent, there is probably no motivation to do it in a unified way.

Since the amount of WeChat's background code is very large, if all the code is violently added to a project, things like ycm will not be able to run at all. Pressing the tab card for 5 minutes may not be able to slow down (gdb will not work either) How dare you press tab). Backend C++ projects are all based on bazel's BUILD file management dependency, which is generally quite extensive. Basically every newcomer will mess with this thing when they first come here, trying to figure out the BUILD-based completion solution, but in the end the performance and accuracy are poor. It is difficult to meet the needs of daily use. My current solution is to use universal-ctags to regularly generate tags for files in commonly used directories, and use experience when writing code.

Writing business on WeChat is very fool-proof. WeChat’s microservice framework svrkit has prepared a bunch of supporting tools to generate code. To create a new service, you need to write a protobuf file with the interface defined in it, and then use this file to generate the framework code of the entire service. Just fill in the business logic. WeChat's C++ basic library provides everything from message queues to string trims. You can basically find all the functions needed to write ordinary business code. It's just a pile of building blocks. For ordinary business departments, interviews are a rocket launcher. Tightening the screws is no exaggeration at all.

There are two most annoying things about WeChat development: one is that the code written by others has no comments, and the other is that you have to write comments when you write the code yourself. This has resulted in many tools, functions, and logic details being passed on by word of mouth, or buried in a vast sea of ​​km articles and emails. If you have nothing to do, you will always be surprised when you look at other people's code...and sometimes scared. Of course, this has been slowly changing recently, and components related to basic capabilities have begun to be systematically introduced in wikis, git issues, and the like.

Author: Aris Wicked
Link: https://www.zhihu.com/question/265829202/answer/1081457634
Source: Zhihu

 

Guess you like

Origin blog.csdn.net/JACK_SUJAVA/article/details/132558276