by metadat · 4y ago · 0 comments
* Consistent build structure
* Rigorous code reviews
* Ginormous company-wide shared filesystem holding all code
* Point-click-drag report building
* Big-query
I'm sure I'm missing additional awesome internal aspects of being a developer at Google, and some parts are also horrendously bad.
* Automated presubmit/bisect queues
* Well built code review ui and not like github
On this topic, most companies will give up on “rigorous code reviews”.
I’d love a tool that helped with context in a larger system design way. Coming in cold on some project and expecting to know all the design decisions, and if the code structure is going away from some higher level goal is where most problems that I’ve seen come in.
I don’t see how any of the current tools help with that, and I somewhat doubt these secret tools do either - but would love to seen them if they do.
Formatting can be almost entirely automated with pre-submit checks that the code is formatted, and automatic formatting tools.
So for your two examples, this practice of adopting a style guide prevents them from arising. The “tabs vs spaces” argument is simply settled, because the style guide has an answer. The “for loop vs for-each loop” is either addressed by the style guide, in which case there is an answer, or it’s not, in which case it is not a legitimate style complaint one way or the other, and the reviewer is making a mistake by bringing it up.
Basically: reviews are actually treated as important.
I was just trying to flowerly highlight that most “in depth code reviews” I’ve seen are very focused on surface level things. I’d dig a tool that focused more on structural changes.
Shameless plug for https://trunk.io/products/check - which will handle universal enforcement of all the tooling for all of the pieces of your tech stack.
To pull an example from the paper, if your line of code says
if (a == b || b == 1)
you might get a comment that says something like> "Changing this line to
if (a != b || b == 1)
> does not cause any test to fail."Page 4 lists other mutations, like replacing logical ANDs/ORs with just `true` or `false`, switching arithmetic plus to minus, etc.
This isn't a larger system design context thing, though, just a testing one.
Disclosure: I work at Google.
I'm also guessing this ties into Google's tooling of being able to tell which line of code is hit by which tests and running those as part of the mutation test?
EDIT: The blog has some discussion about the correlation between some of these mutation failures and real bugs. I remain a little suspicious to be honest. Also
"I also looked into the developer behavior changes after using mutation testing on a project for longer periods of time, and discovered that projects that use mutation testing get more tests over time, as developers get exposed to more and more mutants. Not only do developers write more test cases, but those test cases are more effective in killing mutants: less and less mutants get reported over time. I noticed this from personal experience too: when writing unit tests, I would see where I cut some corners in the tests, and anticipated the mutant. Now I just add the missing test cases, rather than facing a mutant in my Code review, and I rarely see mutants these days, as I’ve learned to anticipate and preempt them."
Now this one is expected, if you build automated tooling that comments on your code review you expect people to try and avoid that. However there's still the question of what's the quality improvement and what's the productivity impact.
1. Search another team's code
2. Quickly jump into a Cloud IDE to make a change
3. Build and test the code, because everyone uses one build system
4. Send that code off for review and have the review tool automatically select the right reviewers and run the right tests
For a simple change (let's say a typo fix) all of the above can happen in a single browser tab in under 5 minutes even if you've never been in that part of the code before.
----
While I'm here a shameless but relevant plug: if you're looking for a Google-like code review experience on GitHub check out https://codeapprove.com
At Coherence, we agree that code search and code review, along with automated code intelligence, are a huge step forward. Tools like sourcegraph, graphite, codeapprove are all solving important problems in the cycle. But we believe that the general approach of “building” vs “buying” development infrastructure for these key steps is holding teams back.
Check us out at withcoherence.com if these sound like problems your team faces, too! (Disclosure, I’m a cofounder)
- BigQuery is available on GCP
- Bazel is an open source Blaze
- google source formatting (for java at least) is open source
There are probably more…
Most of industry still seems unaware that no-knobs data query and pipeline systems even exist. If I only had a dollar for every time I saw a PR tweaking the memory settings of some Spark job or hive query that stopped running as the input data grew....
I'd love to see more people write their workflows using the Apache Beam API so they'll have the option to switch to a no-knobs, scalable pipeline engine in the future even if they're not using one today.
There's a reason it isn't popular outside of elgoog.
IRL, every project tends to do a little bit or a lot of its own thing.
Things like engineers losing time wondering why their node dependencies weren't correctly installed, or dealing with a pre-commit check that reminds them they didn't manually regenerate the generated files, or having humans write machine-friendly configuration that's not actually human-friendly because there's no easy way to introduce custom file transformations during the build.
Bazel doesn't spark joy for me and I wouldn't say I look forward to using it, but personally I would still always choose it for a codebase that's going to have multiple developers and last a long time. It's vastly easier to go with bazel from the beginning than to wish you could switch to it and realize people have already introduced a million circular dependencies and it's going to be a multi-month or multi-year process to migrate to it.
And it's clunky, and you need to teach every new hire how to use it. The juice just isn't worth the squeeze. Just write an adapter in your build infra for the well known tools and be done with it. You'll get much more value putting work into something else, like code review tools, testing, dev environments, staging...
Look at how much pain many companies have gone through to move to K8s from existing infrastructure, there is perceived value driving that.
Bazel lacks that perception of value.
Every real-world build system I’ve seen provides that functionality. In particular a standard make(1) can do it just fine.
If you love fighting with your hands tied behind your back, choose Bazel.
Otherwise, be pragmatic: Learn Make, Maven, and Gradle; then you'll be well-equipped for 95-99% of cases. Thankfully pip and npm are as straightforward as it gets.