Ashley Hedberg on launching Google’s massive open-source C++ library


Interview by Breanne Thomas

Hi Ashley! Can you tell us about your work as a software engineer at Google and this new project your team just launched?

I work on Abseil, which is an open-source collection of C++ library code designed to augment the C++ standard library. We’ve been using these libraries at Google for years, and now we’re releasing them for the larger development community.

I’ve been at Google since August 2015. I started on an infrastructure team, but I’ve spent up to 20% of my work time contributing to Abseil since July 2016. These so-called 20% projects are a great way to explore a project or team completely orthogonal to your primary assignment. I liked it so much that I transferred to Abseil full-time in September. Turns out that I’d rather fix low-level C++ libraries than build a network proxy!

What was the most difficult part in launching Abseil and how did your team overcome it?

The scale of the project was one of the most difficult parts. A significant chunk of our pre-release work involved changing the filenames and namespaces of the most common C++ libraries at Google. For example, we had a file “base/time.h” containing the class base::Time. We wanted to move the file to a new directory, giving it the name “absl/time/time.h”. We also wanted to move it to the absl namespace (i.e. absl::Time). In a smaller codebase, this wouldn’t be so bad — move the file, rename the class, and update users of that class in one set of changes. However, Google has ~12K developers working on ~250M lines of C++ code. Atomically updating the entire codebase for each of these renames was completely out of the question. (Furthermore, we had a team of ~15 people doing these sorts of large-scale changes!)

If we wanted to migrate the entire code base from base::Time to absl::Time, we’d have to do it incrementally. My teammate Jon gave an excellent talk on how we do this at CppCon, which I highly encourage those interested in this topic to watch. Briefly, we used type aliasing to rename the libraries we wanted to release while allowing users of those libraries to continue using the old names. Long-term, we don’t want to maintain multiple sets of names for the same thing, so we’ll be performing a number of automated refactors this quarter to clean up the old names.

You mentioned the project got a great response at CppCon when it was announced. What makes Abseil so important and exciting for community at large and why?

Short-term, Abseil provides some libraries that we hope developers are interested in using. We provide C++11-compatible versions of C++17 types like std::optional, so that developers can use them even if they’re not ready to transition to a C++17 compiler. We also provide alternatives to the standard (such as absl::Time and absl::Mutex) that better serve some use cases.

Longer term, Abseil is committed to stability over time, much like the C++ standard library. But we’re doing this differently from most open-source projects — we’re not using semantic versioning to avoid breaking our users. (Semantic versioning doesn’t actually avoid breaking users anyway, since anything can be a breaking change; I highly recommend our tech lead Titus Winters’ plenary talk at CppCon for more on this issue.) Google has been living at head for years, and we’re asking our users to do the same. If we want to make an API-breaking change, we’ll ship an automated refactor to migrate external users. We haven’t worked out all the details yet, but we’re excited to see C++ as a live-at-head language expand beyond Google.