Ask HN: What is the best code base you ever worked on?
561 pointsAnd what made it so good?
Was there someone enforcing good practices top down? Just being in a group of great engineers? Or something else?
Was there someone enforcing good practices top down? Just being in a group of great engineers? Or something else?
Comments (454) 104 threads
Earlier comments* Creating a mutable snapshot of the entire codebase takes a second or two.
* Builds are perfectly reproducible, and happen on build clusters. Entire C++ servers with hundreds of thousands of lines of code can be built from scratch in a minute or two tops.
* The build config language is really simple and concise.
* Code search across the entire codebase is instant.
* File history loads in an instant.
* Line-by-line blame loads in a few seconds.
* Nearly all files in supported languages have instant symbol lookup.
* There's a consistent style enforced by a shared culture, auto-linters, and presubmits.
* Shortcuts for deep-linking to a file/version/line make sharing code easy-peasy.
* A ton of presubmit checks ensure uniform code/test quality.
* Code reviews are required, and so is pairing tests with code changes.
Hundreds, huh? Is this a typo? It makes me wonder if the whole comment is facetious. Or do C++ programmers just have very low expectations for build time?
Continue this thread — 2 replies
As with all things Google, it's a pain to get up to speed on, but then very fast.
Readability really does help new engineers get up to speed on the style guide, and learn of common libraries they might not have known before. It can be annoying - hell, I'll have to get on the Go queue soon - but that's ok.
Continue this thread — 7 replies
- I worked on Google Assistant which was responsible for integrating many services. This meant I had to work with other peoples code way more regularly that many at google.
- I moved from FB to google - I'm not really sure how many people have had this experience. I think many of my colleagues at google found it surprising how many of the things they thought were unique to google actually also existed at FB.
At the end of the day, any of these processes have pros/cons but I think the cruft of having APIs that are a couple steps harder to evolve due to finding Readability/Owners for everything you touch just makes things slightly less cohesive and a trickier place to have a "good" codebase.
When I worked at FB, I would frequently rebase my code on Monday and find that, for example, the React framework authors or another smaller infra team had improved the API and had changed *every* callsite in the codebase to be improved. This type of iteration was possible in certain situations but was just much less common at google than at fb.
Continue this thread — 11 replies
Googles a mess. There’s always a migration to the latest microservices stack that have been taking years and will take many more years to come.
Like meta just changed the damn language they work in to fit their needs and moved on. Google rewrites everything to fit the language. The former method is better in a large codebase. Meta is way easier to get shit done to the point that google was left in the dust last time they competed with meta.
https://www.moderndescartes.com/essays/readability/
Move fast and break things, right?
* https://abseil.io/resources/swe-book/html/ch17.html
Continue this thread — 15 replies
Continue this thread — 7 more replies
I have a Laravel project that I have maintained for a customer for seven years. The app is straightforward and allows users to create portals that list files and metadata, such as expiration dates and tags.
Every other year, they ask me to add a new batch of features or update the UI to reflect the business's branding. As the app is so small, I have the opportunity to review every part of the app and refactor or completely rewrite parts I am not happy with.
It is a joy to work on and I always welcome new requests.
Q: is it actually the code that you loved, or simply the tooling that exists?
(and if it's tooling, why can't that type of tooling be replicated for other codebases outside of google?)
The elegance of the tooling from what I hear is that there's tons of different tools maintained by different teams that work seamlessly (and fast) together to produce google3 and all of its supporting pieces.
But to answer your question, sure it can. But good luck building your own. Google has been doing this since the 2000s.
And if you're a big company already, you've already bought into your existing patterns & design choices; things like that are VERY hard to change.
I think the reason its not easy replicable is:
1. It takes a ton of initial investment and ongoing maintenance but its worth it when your code base is gigantic.
2. There is a consistent set of top down enforced rules. With the consistency it becomes much, much easier to build tight integrations between tools.
(almost?) everything is buildable by a single build system (blaze). When anyone can consistently build/test/run anything in your codebase it becomes a lot easier to build a whole host of potential tools like code search.
Probably someone can dive deeper than I can. But one thing I learned the most important property for a code base to be maintainable/scalable is consistency.
Things like on team rosters, on call rosters, code review permissions, service permissions, feature flags.
All of it stored in google3 and can all utilize the same consistent set of tooling like presubmit test, integration tests, deployment automation, permissions, code search.
Its sort of like Infrastructure as Code but more.
As someone who hasn't worked for Google, how does Google's implementation of this differ from e.g. Guix/nixpkgs? Being able to easily build/test any available package is a big reason I like using tools like those.
I think the public bazel (public version of blaze) docs is probably the best place to look.
https://bazel.build/basics/hermeticity
Bazel isn't the whole of everything though, the other piece being exported is kubernetes, which isn't Google's borg, but that's its roots. There's Apache Airflow if you need a workflow engine like Sisyphus, no shortage of databases to choose from, though now we're drifting into the operations side of things.
But basically, Google has invested untold millions of dollars in the form of SWE and other engineering hours into making Google3 operate. If anyone else invested that kind of dough, with enough smarts, they'd also be able to make it a good experience. The problem is few people have that kind of budget, and even fewer invest in that thing, preferring to use free tools instead.
What tool do you use to edit code, and how much did your employer spend on that for you?
E.g., Codespaces, CoPilot, Actions, etc?
(genuinely curious, not trolling)
Codespaces is like CitC; I haven't been a Google since the rise of AI so I can't comment on how the internal equivalent to Copilot is; Actions is very primitive compared to what Google has, but yeah, you can see where it's going. it doesn't compare right now but it could, eventually.
Continue this thread — 2 replies
Continue this thread — 1 more reply
All comments shown.
Couldn't load more comments. Check your connection and try again.