
How Google builds web frameworks - hackyio
https://medium.freecodecamp.com/how-google-builds-a-web-framework-5eeddd691dea#.wsda6mh7o
======
shuzhang
maybe I'm missing something, but there's a lot here that don't sound right...

"When you employ trunk-based development in a single huge repo, you have only
one version of everything. That’s kind of obvious. It’s still good to point it
out here, though, because it means that — at Google — you can’t have app
FooBar that’s using AngularDart 2.2.1 and another app BarFoo that’s on 2.3.0.
Both apps must be on the same version — the latest one."

I don't see how sharing the same repo implies everything uses the exact same
dependencies. Why can't apps share the same repository and specify their own
dependency versions?

"What if AngularDart needs to make a major breaking change (say, going from
2.x to 3.0) and that change breaks 74 thousand tests? Will the team go and fix
all of them? Will they make changes to thousands of source files, most of
which they haven’t authored? Yes."

This just doesn't sound reasonable. I could see forcing framework devs to fix
mission-critical stuff on some google's biggest projects, but every single
one? Hundreds/thousands of projects?

"One of the cool things about having a sound type system is that your tooling
can be much more useful. In sound Dart, tools can be sure that a variable is
of a certain type, for example. For refactoring, that means that many changes
can be completely automatic, with no need of confirmation from the developer."

I'm sure a good deal of API changes can be fixed with automated refactoring,
but plenty can't! How do you automatically go from factory pattern to builder
pattern for example. More importantly, I'm assuming developers don't have all
86TB of the code checked out locally and loaded up in an IDE... So how is this
automated refactoring done?

~~~
floitsch
I'm not really working on Google3 (the shared code base) but I hope the
following answers might still be helpful.

Same repo: projects in Google are encouraged to use other project's code. You
can only do that if the versions of their dependencies match. The general
guideline is that all projects use the latest version and move in sync.

Breaking Changes: I have never been involved in such a huge breaking change,
but I would expect that the conversion is done gradually. Ideally, some teams
are also helping in the migration (or sign up as guinea pigs to test the
latest versions).

Automatic refactoring: These refactorings are done with a tool called Rosie.
Search for "Google refactoring, Rosie" to find some papers/documents about it.
One of the first hits was this document:
[http://cacm.acm.org/magazines/2016/7/204032-why-google-
store...](http://cacm.acm.org/magazines/2016/7/204032-why-google-stores-
billions-of-lines-of-code-in-a-single-repository/fulltext)

