代码可读性培训流程 SA16225461 郑航
There's no formal internal training
Mandatory training Google codelabs提供指导,教程和动手编码练习。 大多数codelabs将引导您完成构建小型应用程序的过程,或向现有应用程序添加新功能。 它们涉及广泛的主题,如Android Wear,Google Compute Engine,Project Tango和iOS上的Google API。
Choose your preferred programming language (C++, Java, Python, etc.) a single machine with two keyboards and mice Bring you up to speed with particular libraries or testing framework
Culture-Driven Process You can't get anything submitted unless you go through a code review
Getting a code review is necessary, but not sufficient and efficient Getting a code review is necessary, but not sufficient and efficient. You must get the change approved by someone who's marked as a maintainer of the package being changed and you must get it approved by someone who has readability in the language(s) you're programming in. It could be the same person approving the change for both. you will want to earn your readability for your languages of choice. Getting readability involves making a significant, sizable change or code contribution, that is comprehensive enough to show that not only you're capable of following the coding style, but also that you "get" how code is written and tested at Google. You only get readability for one language at a time, because different languages have different styles and conventions. 进行代码审查是必要的,但不够足够和高效。 您必须获得由被标记为要更改的package的维护者的人员批准的更改,并且您必须获得具有您所编程语言具备可读性的人员的批准。这两者可能是同一人。 您将需要为您选择的语言获得可读性。 具备可读性包括进行重大的,相当大的更改或代码贡献,这足以显示您不仅能够遵循编码风格,还可以“获取”代码如何在Google编写和测试。 一次只能读懂一种语言,因为不同的语言有不同的样式和惯例。 Code readbility
Once you have code readability, say in C++, you only need to get your C++ changes reviewed by somebody else, and maybe also get approval from package maintainers when making changes to other packages. I thought that this system was pretty effective in practice. Most people play the game, and it does help in a big way to get a more consistent, higher quality code base. Mandatory code reviews are sometimes seen as a burden, especially when reviewers are slow to get back to you, but overall I think the benefits far outweigh the downsides. 一旦你具备代码可读性,以C ++为例,你只需要让其他人对C ++进行的更改进行审查,也可以在得到软件包维护者的批准对其软件包进行更改。我认为该系统在实践中非常有效。 大多数人遵守这一约定,它有助于获得更一致,更高质量的代码库。 强制性的代码审查有时被认为是一种负担,特别是当你成为审查者的时候,总体而言,我认为这些好处远远超过了缺点。 Code readbility
Developer Handbook: It describes what subset of C++ features are used, along with the justification for using or not using each feature. Features of C++11 are being slowly opened up for usage after looking at their pros and cons. Style Guide: Publicly available as http://google-styleguide.googlec..., the style guide embodies a lot of conventional wisdom from experienced developers. It's the most cited document in code reviews.
Internal wiki and other pages: Some Googlers tend to write down their opinions about programming style, best practices and other acquired wisdom about internal technologies. You can often see both sides of an argument argued on different pages, and ultimately it's up to you or your team to choose the right approach. Codelabs: These are mini-tutorials to get you up and running in a certain technology. Apart from Google internal technologies (Protocol Buffers being one publicly known example), there are a few Codelabs on C++ best practices, like efficient string usage, multithreading, etc.
Code Search: One of the perks of being at Google is that you have access to the entire codebase, even as an intern. For certain internal technologies, the code is your only source of documentation and you often end up on Wikipedia-like trips through the source. The code search team does some stunning code analysis, making it really easy to navigate the source code and learn how certain things are done. You can do seriously complicated searches to (for example) find the exact use case of a certain function. It gets rid of a lot of frustrations people feel when working on a new codebase. Code Reviews: These are one of the most useful resources if your reviewer is nice enough to include personal experiences and anecdotes, or cites documents like the style guide or the C++ FAQ (mine was). I thoroughly enjoyed my code reviews because my mentor often gave interesting insights into why certain things are done the way they are.
谢谢观看!